Hello cms devs,
I am doing a frontend module where i want to show other action than 'default' which links to another action. i did trying this and the links returns to the first action
A little example how the test was made
in a page i write {cms_module module="Name" action="category_list"}
this action displays a categories with link to the next action named category_products
but when i click over the link it returns to category_list
If i do this with {cms_module module="Name" action="default"} which shows the category_list action it redirect correctly to category_products
I just want to display records from module database in other block of template because the default action is used for different front proccess
How can i make right redirection to another action without using default action?
Please help
Developing frontend module without default action
Developing frontend module without default action
Last edited by newclear on Sat Oct 21, 2006 1:01 pm, edited 1 time in total.
Re: Developing frontend module without default action
I made another test while trying to display different action which redirrect to another action (i am not using default)
I added
{cms_module module="name" action="category_list"}
This action have code to reddirect to category_products action using RedirectForFronEnd function.
I made debug var true to display the redirection and when page shows the debug message and i clicked over it page allways loads the same debug message for redirection.
The only answer that i found is that i must use default action if i want to make redirection or link to another action of the module.
Does someone find solution to handle different actions in front with links between them?
Please help!
I added
{cms_module module="name" action="category_list"}
This action have code to reddirect to category_products action using RedirectForFronEnd function.
I made debug var true to display the redirection and when page shows the debug message and i clicked over it page allways loads the same debug message for redirection.
The only answer that i found is that i must use default action if i want to make redirection or link to another action of the module.
Does someone find solution to handle different actions in front with links between them?
Please help!
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Developing frontend module without default action
I think the 'action' param is arbitrarily set. and you can't use that, that's why we use 'mode' everywhere, so in your action.default.php
you can do a switch based on $params['mode'] and do whatever you need to do.
you can do a switch based on $params['mode'] and do whatever you need to do.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Developing frontend module without default action
Taking my usual stab in the dark with no testing...
In your module class:
In your module class:
Code: Select all
function DoAction($name, $id, $params, $returnid='')
{
if ($name == 'default') $name = 'mynewaction';
return parent::DoAction($name, $id, $params, $returnid);
}
Re: Developing frontend module without default action
Thanks both of you guys.
maybe action is really arbitrarily set.
I found a way of solving this with using {cms_module module="name"} which goes to default and doing switch based on my needs.
Now i found a bigger problem.
While trying extend the use of module in front i stick over this.
Let's say that i want to use module action which shows search form and also use other module action which shows all categories's products without search.
I put the search form in the template. it givens some id for the form.
I put the products in a page and it givens other id for the product link.
I also made seting $returnid where i want to get back from the search form.
I found that the id's for given instance of the module comes wrong after submiting the form and nothings happens.
I am talking about simple search at left and product listing at right using one module and i hope that i didn't found the dead end.
Can you people have a solution using dynamically many instances of a module in front end?
maybe action is really arbitrarily set.
I found a way of solving this with using {cms_module module="name"} which goes to default and doing switch based on my needs.
calguy1000 can you tell me a place where I can see 'mode' parameter in use.calguy1000 wrote: we use 'mode' everywhere, so in your action.default.php
you can do a switch based on $params['mode'] and do whatever you need to do.
Now i found a bigger problem.
While trying extend the use of module in front i stick over this.
Let's say that i want to use module action which shows search form and also use other module action which shows all categories's products without search.
I put the search form in the template. it givens some id for the form.
I put the products in a page and it givens other id for the product link.
I also made seting $returnid where i want to get back from the search form.
I found that the id's for given instance of the module comes wrong after submiting the form and nothings happens.
I am talking about simple search at left and product listing at right using one module and i hope that i didn't found the dead end.
Can you people have a solution using dynamically many instances of a module in front end?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Developing frontend module without default action
I use mode all over the place in the uploads module, the calendar module calls it 'display', and then there are a bunch of other modules that do similar things. Here's an example of one way it could be implemented:
As far as using multiple module instances on a page, it works well.... You can try it out with the news module as much as you want. it works great. just put two (or more) {cms_module module=modulename .... } tags into your template and/or page and it will work, and the parameters can be different for each call.
Code: Select all
// call like this {cms_module module=modulename mode=test }
function DoAction($name, $id, $params, $returnid='')
{
switch( $name )
{
case 'default':
{
$mode = (isset( $params['mode'] )) ? $params['mode'] : '';
switch( $mode )
{
case 'test':
$this->handleTestMode( $id, $params, $returnid );
break;
}
}
} // end switch
}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
module multiple instances
Thanks again for the answer calguy
I am trying multiple instances of a module with other way of use.
I want when the first instance that holds form submit to make changes on the next instance.
I found a solution for this but i think is more hardcoded because i follow the givven id for a module instance.
a little example
At left i have instance with form. it holds m3 id.
At right i have instance with listing with m4 id.
my solution is to hide the first instance when it is submitted via pluggin.
This makes the second instance becomes first and give it m3 id.
So it takes the parameters from the submitted form and works fine.
The problem while working with multiple instances of a module is to dynamically change the data from a second instance based on the choise of the first instance without any adapted id.
Maybe an other way of use will be to have bigger container which holds all the module needs and no other module instances.
I am trying multiple instances of a module with other way of use.
I want when the first instance that holds form submit to make changes on the next instance.
I found a solution for this but i think is more hardcoded because i follow the givven id for a module instance.
a little example
At left i have instance with form. it holds m3 id.
At right i have instance with listing with m4 id.
my solution is to hide the first instance when it is submitted via pluggin.
This makes the second instance becomes first and give it m3 id.
So it takes the parameters from the submitted form and works fine.
The problem while working with multiple instances of a module is to dynamically change the data from a second instance based on the choise of the first instance without any adapted id.
Maybe an other way of use will be to have bigger container which holds all the module needs and no other module instances.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Developing frontend module without default action
If you need to communicate between two instances of a module on a page, you can use globals, or session variables. though a global would probably be the best way to do it.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Developing frontend module without default action
Thats a good idea.
Thanks for helping me resolve my problems.
I will test using sessions
Thanks for helping me resolve my problems.
I will test using sessions