[solved] Smarty: How to make a condition

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
makenskiy
New Member
New Member
Posts: 6
Joined: Mon Oct 31, 2011 6:35 am

[solved] Smarty: How to make a condition

Post 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?
uniqu3

Re: Smarty: How to make a condition

Post 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}
makenskiy
New Member
New Member
Posts: 6
Joined: Mon Oct 31, 2011 6:35 am

Re: Smarty: How to make a condition

Post by makenskiy »

Thank you very much! It's working.
Post Reply

Return to “Layout and Design (CSS & HTML)”