Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
'unless' statement, like Perl's

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
clone46
Smarty Rookie


Joined: 13 Jan 2006
Posts: 13

PostPosted: Thu Dec 02, 2010 5:46 pm    Post subject: 'unless' statement, like Perl's Reply with quote

Hello!

I would love to see the addition of the 'unless' statement. It's basically the same as "if not". It would work something like this:

{unless $foo == 6}
do something
{/unless}

It's most convenient in situations like this:

{unless $foo == 6 && $bar == 4}
do something
{/unless}

Thanks,
- Bret
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7038
Location: Lincoln Nebraska, USA

PostPosted: Thu Dec 02, 2010 5:59 pm    Post subject: Reply with quote

It's just syntax fodder Smile

Code:
{if !( $foo == 6 && $bar == 4 )}
do something
{/if}


FYI Smarty 3 you are free to make your own compiler funcs.
Back to top
View user's profile Send private message Visit poster's website
clone46
Smarty Rookie


Joined: 13 Jan 2006
Posts: 13

PostPosted: Thu Dec 02, 2010 7:52 pm    Post subject: Reply with quote

Yup, it's just "syntactic sugar". mmmm... candy.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP