Navigation

Views

Search
 

Toolbox

Conditional Tags

From Documentation

Revision as of 20:36, 22 May 2006; view current revision
←Older revision | Newer revision→

The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to welcome a logged in site visitor with a nice friendly greeting.

{if $smarty.session.username<>""} Welcome back {$smarty.session.username} {/if}

That may look pretty complex but actually it is very simple once you get your head around. The first portion {if $smarty.session.username<>""} checks to make sure they are logged in and their username is not blank. Next the welcome back portion just prints their name if the first condition is true.