I'd like my module to return more than one content block, e.g. the main content and a sidebar. So a product page might have the product description in one div, and links to similar products in another.
I could have my module's template return both items together, but then I'm coding my overall page layout into the module template.
I could call my module twice on the page - {mymodule action='sidebar'} ... {mymodule action='main_content'}, but it's cumbersome, and in any case doesn't work for a page invoked using CreateLink...
What I think I used to do was put the sidebar into a Smarty variable:
Code: Select all
$this->smarty->assign('sidebar', $this->ProcessTemplate('sidebar.tpl'));
Code: Select all
{if isset($sidebar)}{$sidebar}{else}{content block='Sidebar'}{/if}
Can I still access my Smarty variables in a template? Is there a better way of doing all this?
As an aside, I sometimes want a page (linked from a CreateLink, or called via a URL defined by RegisterRoute) to be rendered in a specific page template. For example, I might want a Products page to link to ProductDetails pages, with the latter then rendered using the ProductDetails template. I think I have to set the returnid to the id of a (dummy) page which uses the required template. Is this right, and if so how do I work out what it is? Or is there a better way?
Thanks to anyone who understands my issues and can shed any light.
Brian