Page 1 of 1
{if} syntax
Posted: Tue Mar 21, 2006 6:27 pm
by Rui Pinheiro
Hi!
The {if] sentence used in templates is only for testing null variables? For instance, is there any way to use something like this?
{if title == "Homepage"}
Still no list of {} variables, right?
Thanks!
Re: {if} syntax
Posted: Tue Mar 21, 2006 6:33 pm
by calguy1000
See this link:
http://forum.cmsmadesimple.org/index.ph ... cseen.html
It should help, but you're right there isn't a reference of already exported variables.
Re: {if} syntax
Posted: Wed Mar 22, 2006 6:24 pm
by rcpinheiro
Thanks. That solves half of my problems

Any way to get modules variables that way? For instance, I would like to get the category field in the News module. $gCms doesn't have that info, $params['category'] also doesn't work. (This is VERY useful to use different templates for each category)
Thanks in advance!
Re: {if} syntax
Posted: Wed Mar 22, 2006 6:27 pm
by calguy1000
see the post I just posted with the get_template_vars user defined plugin I wrote.
Technically speaking, putting this at the bottom of your content when you have other module tags above it, should give you an idea of the available smarty variables.
Re: {if} syntax
Posted: Wed Mar 22, 2006 6:35 pm
by alby
rcpinheiro wrote:
Any way to get modules variables that way? For instance, I would like to get the category field in the News module. $gCms doesn't have that info, $params['category'] also doesn't work.
See in Summary template:
Code: Select all
{foreach from=$items item=entry}
<div class="NewsSummary">
<div class="NewsSummaryLink">
{$entry->titlelink}
</div>
<div class="NewsSummaryCategory">
{$entry->category}
</div>
.........
rcpinheiro wrote:
(This is VERY useful to use different templates for each category)
Maybe:
{cms_module module="news" category="beer" summarytemplate="sometemplate.tpl"}
Alby
Re: {if} syntax
Posted: Wed Mar 22, 2006 6:48 pm
by rcpinheiro
calguy1000 wrote:
see the post I just posted with the get_template_vars user defined plugin I wrote.
Thanks, so this should do it, right?
Code: Select all
$gCms->smarty->get_template_vars('category');