Hello,
Is it possible to change the page template from a module's action file?
Suppose I have a page products.html in which I have embedded a custom module "Products". Now, is it possible to change the page template from a module's action file. That is, the page will have different templates based on different actions called.
Thanks,
Jatinder
How can I change page template from a module?
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: How can I change page template from a module?
No, you can't change the page template, however your module can export smarty variables via
that you can later test for in your template logic.
i.e: if your template has a call in it.
Then in your page, you can embed
that has the code above in it.
Then later in your template, you can something like this
Code: Select all
$smarty->assign('foo','bar' );i.e: if your template has a call in it.
Then in your page, you can embed
Code: Select all
{cms_module module='mymodule' mode='blah'} Then later in your template, you can something like this
Code: Select all
{if isset($foo) && $foo == 'bar' }
{* don't include search, if the foo variable is set *}
{else}
{search}
{/if}
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: How can I change page template from a module?
Thanks for the replies, but I have managed to solve the problem on my own.
It involves passing the "showtemplate" parameter from the module. If the value of this parameter is "false", CMSMS will not use the template associated with the page. Then I can echo any output I want from the module.
Can anyone suggest a better solution?
It involves passing the "showtemplate" parameter from the module. If the value of this parameter is "false", CMSMS will not use the template associated with the page. Then I can echo any output I want from the module.
Can anyone suggest a better solution?

