View Full Version : parameters -howto?
Blackrider
14.05.2004, 12:52
Hi there, I read a couple of posts here, but still I'm not sure, I understand the parameter thing.
So the syntax within the script would be
$testpara = $params->testpara;
And at the place where you enter the parameters, say at the Menu Manager, when creating a new Menu Item, it would be:
testpara = Hello World
And again at the script, if you echo $testpara it should display "Hello World", right?
As simple as that, or do I have to initialize something? 'cos it won't work with my component.
I'm trying to port some php scripts to mambo - for first a little slideshow with a couple of pics from different years. Not too exciting, though, but I want to set one menu item for the first year, and another for the next year and thus would like to use parameters.
Is there a tutorial or a manual for coding components or moduls somewhere? I googled a lot, but found just a manual for front- and backend.
Appreciate your help!
Blackrider
14.05.2004, 14:40
Meanwhile I discovered, that not only my little script doesn't like parameters but also Stingrays Display News. So maybe this is not an development issue but more an installation thing.
Maybe the post should be moved.
Help or any ideas anyway?
Thx!
:confused:
stingrey
14.05.2004, 20:30
Hmmm I definitely think you might have some sort of problem as I can gurantee you that parameters do work in my module.
Might need to elaborate on whether you are getting any other errors.
One thing I just noticed, are you making a module or a component?
This may have bearing on your problem.
Blackrider
15.05.2004, 16:44
yep. that's the point. It's a component. So that won't work.
Would you suggest to code my component as a module? But that would make the slideshow control a little more difficult. I'm a mambo newbie, and maybe you have some hints for me.
Now, I'm controlling my script by adding variables to the url, which calls the component. And doing so I set a Menu Item in Main Menu.
looks like: index.php?option=com_slide&yr=02
Works fine, but I thought it would be more elegant with parameters, since you would call the same component with different parameters right from the setting of the Menu Item in Main Menu.
@stingrey: I guess your parameters will work at my installation as well. Probably I just used parameters at the wrong place. This is very likely since anything else works fine. I'll check that as soon as I have access again to my staging system.
Thanks anyway!
Thomas
stingrey
15.05.2004, 18:56
@stingrey: I guess your parameters will work at my installation as well. Probably I just used parameters at the wrong place. This is very likely since anything else works fine.Yeah thats correct. Thats what i meant when I said:
One thing I just noticed, are you making a module or a component?
This may have bearing on your problem. I should have explained myself better.
One solution.
Use you existing component to control the admin backend for your slideshow.
Then create a module to access the data produced by you component.
Then you have a module that accepts parameters to control what is dsiplayed.
-----------------
Think of it this way. My Display News modules are modules that accept parameters to control what is displayed when you input information into the News/Item component that is controlled in the Admin Backend.
Same thing for my Display Menu modules. THey can only work because of the Main Menu component that exists. My modules are not standalone modules, they need an underlying component that controls the data to actually work.
Without the components, my modules are useless.
userID10T
24.01.2005, 18:34
Find out how to do this:
In menu item pointing to your component in parameters section text area add:
task="create"In your main component file bla.php
$menu = new mosMenu( $database );
$menu->load( $Itemid );
$params =& new mosParameters( $menu->params );
switch($params->get( 'task' )) {
case "create":
create();
break;
default:
show();
break;
}
vBulletin® v3.8.0, Copyright ©2000-2013, Jelsoft Enterprises Ltd.