Page 1 of 1
Give parameters to the news module
Posted: Tue Sep 12, 2006 8:35 am
by aleix
Hi everybody,
a have a template in which I have 3 news modules, with 3 categories and 3 different templates.
It is...
{cms_module module='news' number='5' category='category1' summarytemplate='new1.tpl' detailtemplate='dnew1.tpl'}
{cms_module module='news' number='7' category='category2' summarytemplate='new2.tpl' detailtemplate='dnew2.tpl'}
{cms_module module='news' number='4' category='category3' summarytemplate='new2.tpl' detailtemplate='dnew3.tpl'}
I would like to change the "number" to show, but with a variable, so it can change deppending on some event...
Well, the question is:
How can I do that??
Thanks!!
Re: Give parameters to the news module
Posted: Tue Sep 12, 2006 8:49 am
by cyberman
Dont know if it will work but have you tried this
Code: Select all
{cms_module module='news' number='{php}$number{/php}' category='category1' summarytemplate='new1.tpl' detailtemplate='dnew1.tpl'}
Dont forget to switch on Smarty plugins in config.php
Or this
Code: Select all
{cms_module module='news' number='{userdefined_tag}' category='category1' summarytemplate='new1.tpl' detailtemplate='dnew1.tpl'}
Re: Give parameters to the news module
Posted: Tue Sep 12, 2006 10:50 am
by aleix
I tried what you suggested, but it doesn't work...
It should be a way, but I can't find it!
Re: Give parameters to the news module
Posted: Tue Sep 12, 2006 11:36 am
by cyberman
Have you defined $number or {userdefined_tag} before?
Re: Give parameters to the news module
Posted: Tue Sep 12, 2006 11:45 am
by aleix
yes I did....
Re: Give parameters to the news module
Posted: Thu Sep 14, 2006 12:16 pm
by Dr.CSS
You could use the expiration date at the bottom and not have to use the numbers in the tag.
Make the article to have a start and end date and it will show up then go away after it expires.
Re: Give parameters to the news module
Posted: Thu Sep 14, 2006 2:37 pm
by mahjong
Create a User Defined Tag (UDT) with your event handler. Assign the numbers to smarty variables:
Code: Select all
Global $gCms;
...
$gCms->smarty->assign('number1' , 5 );
$gCms->smarty->assign('number2' , 7 );
$gCms->smarty->assign('number3' , 4 );
Insert the UDT where you need it.
Code: Select all
{your_UDT}
{cms_module module='news' number=$number1 ...}
{cms_module module='news' number=$number2 ...}
{cms_module module='news' number=$number3 ...}
Re: Give parameters to the news module
Posted: Thu Sep 14, 2006 3:03 pm
by calguy1000
Or.... entirely in smarty:
Code: Select all
{assign var=number1 value="5"}
{assign var=number2 value="7"}
{assign var=number3 value="4"}
{cms_module module=news number=$number1 ...}
{cms_module module=news number=$number2 ...}
{cms_module module=news number=$number3 ...}