{if} syntax

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Rui Pinheiro

{if} syntax

Post 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!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: {if} syntax

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

Re: {if} syntax

Post by rcpinheiro »

Thanks. That solves half of my problems :D
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!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: {if} syntax

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

Re: {if} syntax

Post 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
rcpinheiro

Re: {if} syntax

Post 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');
Post Reply

Return to “Developers Discussion”