Page 1 of 1

[solved] Smarty: How to make a condition

Posted: Mon Oct 31, 2011 7:09 am
by makenskiy
Hi! Sorry. I badly speak English.

There is a global_block or news_block. How to make a condition for show only on the main page?

Example 1:

Code: Select all

{if action='index'}
block 1
{/fi}
Example 2:

Code: Select all

{if action='about'}
block 1
{else}
block 2
{/fi}
Where look at variable pages in the code CMS?

Re: Smarty: How to make a condition

Posted: Mon Oct 31, 2011 7:36 am
by uniqu3

Code: Select all

{if $page_alias == 'home'}
 do something
{else}
something else
{/if}
or assign that block and check if block is not empty

Code: Select all

{content block='some_block' label='My nice Startpage block' assign='foo'}

{if !empty($foo)}
{$foo}
{else}
bar
{/if}

Re: Smarty: How to make a condition

Posted: Mon Oct 31, 2011 4:45 pm
by makenskiy
Thank you very much! It's working.