Give parameters to the news module

General project discussion. NOT for help questions.
Post Reply
aleix

Give parameters to the news module

Post 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!!
cyberman

Re: Give parameters to the news module

Post 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'}
aleix

Re: Give parameters to the news module

Post by aleix »

I tried what you suggested, but it doesn't work...

It should be a way, but I can't find it!
cyberman

Re: Give parameters to the news module

Post by cyberman »

Have you defined $number or {userdefined_tag} before?
aleix

Re: Give parameters to the news module

Post by aleix »

yes I did....
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Give parameters to the news module

Post 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.
mahjong

Re: Give parameters to the news module

Post 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 ...}
Last edited by mahjong on Thu Sep 14, 2006 2:39 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Give parameters to the news module

Post 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 ...}
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.
Post Reply

Return to “General Discussion”