I want my module to create multiple pieces of content on a linked page, to be output by various content blocks in my detailpage.
I think I've worked out that the $returnid on the CreateLink() needs to be the id of the detail page I want to use for output, but by default my output goes into {content}.
How do I create several contents? I assume I have to assign them to Smarty variables, but then can I get at them?
I'm sure I've seen something by Ted or CG about this, but I can't find it after an hour of searcching...
Also/alternatively... How can I get at the page URL params within my module - e.g. given
$link = CreateLink($id, 'action1', $returnid, 'Action 1', array('pid'=>$pid));
and on the action1 page a call of
{cms_module module='MyModule' action='action2'}
how in action.action2.php can I get the value of pid?
Thanks in advance, Brian
Creating multiple content in a module
Re: Creating multiple content in a module
You can create multiple content blocks by doing the following in your template:
etc.
When editing/adding a page using that template, you will see a TinyMCE text box for each content block.
Code: Select all
{content}
{content block="foo1"}
{content block="foo2"}
When editing/adding a page using that template, you will see a TinyMCE text box for each content block.
Last edited by Wishbone on Tue Mar 17, 2009 8:52 pm, edited 1 time in total.
Re: Creating multiple content in a module
CreateLink (http://www.cmsmadesimple.org/api/class_cms_module.html#41eb0ceb35a9902845af261fa01564a5) has a $inline parameter that toggles whether the module action will replace the {content} tag or the link itself (it's cms_module tag).brippon wrote: I think I've worked out that the $returnid on the CreateLink() needs to be the id of the detail page I want to use for output, but by default my output goes into {content}.
I'm not sure I understand exactly what you mean, but if your question is how to retrieve parameters meant for another instance of your module, to my knowledge there is no very fast way. I would see two possibilities :Also/alternatively... How can I get at the page URL params within my module - e.g. given
$link = CreateLink($id, 'action1', $returnid, 'Action 1', array('pid'=>$pid));
and on the action1 page a call of
{cms_module module='MyModule' action='action2'}
how in action.action2.php can I get the value of pid?
If your {cms_module module='MyModule' action='action2'} is after the module action, you can simply use action1 to assign your pid to smarty and afterwards pass it to the action2 as a parameter. In action1 you would have something like :
Code: Select all
$this->smarty->assign("pid", $phpvar_for_pid);
Code: Select all
{cms_module module='MyModule' action='action2' pid=$pid}
Otherwise, you'd have to retrieve the pid from the url...
Last edited by plger on Sun Mar 22, 2009 9:36 am, edited 1 time in total.