 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
terryjohnson Smarty Rookie
Joined: 03 Jan 2004 Posts: 9 Location: Chatham, ON, Canada
|
Posted: Mon Mar 15, 2004 9:16 pm Post subject: Short Form of IF - {$var ? 'foo' : 'bar'} |
|
|
If it is not already possible to do this (as an undocumented feature), please could it be added?
It would be very useful for translating boolean values into human-readable texts. For example:
Customer is {$bloke ? 'Male' : 'Female'} |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7062 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 15, 2004 9:20 pm Post subject: |
|
|
You can do this with if/else pretty easily:
{if $bloke}Male{else}Female{/if}
If you want, you can make a modifier:
{$bloke|bool:"Male":"Female"} |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|