[as solved as it can be] Proper way of retrieving another module's parameters
Posted: Sun Apr 26, 2009 4:10 pm
Hi everyone,
I've been creating modules for a while now, and still struggle with the following problem. It has been slightly touched in other topics, but never got a satisfactory solution...
Let's say we have a template with two columns : the left one calls a module (we'll call this module call A), and the right one is the {content}. Now let's say that in the {content}, I click on a link to a module action, and my {content} is replaced by a call to a module (module call B), which could be the same module as call A or any other. Now the problem is the following : in module call A, how can I know what parameters are given to module call B?
So far, I've found 2 possibilities :
1) We move module call B BEFORE module call A, so that we can store the params for the module call A to retrieve. The output of module call B can be assigned to a variable and displayed later. But this seems inelegant, plus it requires changes to the code of both modules (if there are different).
2) We read the parameters of the module action (module call B) from the url. That's what I do right now, but it can get complicated because you have to deal with cases of normal, pretty or rewritten urls...
So basically, I'd like a way for my module to get to know what the other modules (or at least the module action link I've clicked on) are doing in the page. The cms decodes the url to get the module, action and parameters - so I find rather dumb to do it again by myself.
Have I just not found where it is stored? Is there a way to retrieve this?
Thanks,
Pierre-Luc
I've been creating modules for a while now, and still struggle with the following problem. It has been slightly touched in other topics, but never got a satisfactory solution...
Let's say we have a template with two columns : the left one calls a module (we'll call this module call A), and the right one is the {content}. Now let's say that in the {content}, I click on a link to a module action, and my {content} is replaced by a call to a module (module call B), which could be the same module as call A or any other. Now the problem is the following : in module call A, how can I know what parameters are given to module call B?
So far, I've found 2 possibilities :
1) We move module call B BEFORE module call A, so that we can store the params for the module call A to retrieve. The output of module call B can be assigned to a variable and displayed later. But this seems inelegant, plus it requires changes to the code of both modules (if there are different).
2) We read the parameters of the module action (module call B) from the url. That's what I do right now, but it can get complicated because you have to deal with cases of normal, pretty or rewritten urls...
So basically, I'd like a way for my module to get to know what the other modules (or at least the module action link I've clicked on) are doing in the page. The cms decodes the url to get the module, action and parameters - so I find rather dumb to do it again by myself.
Have I just not found where it is stored? Is there a way to retrieve this?
Thanks,
Pierre-Luc