Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

feture request: condition(or some other keyword) compile

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  

Don't you agree?
No, you're superising. that's what i need.
0%
 0%  [ 0 ]
Yes, i don't like it...
100%
 100%  [ 1 ]
Total Votes : 1

Author Message
yarco
Smarty Regular


Joined: 20 Mar 2009
Posts: 39

PostPosted: Tue Jul 07, 2009 8:38 am    Post subject: feture request: condition(or some other keyword) compile Reply with quote

Though i could do it use if/else keywords, what i've said here is not the logical of views.

For example:
I would like to add google analyze script in my product version page, but don't want it in develope version. So i could use such keyword to exclude that.

{condition value="production"}
...google scripts...
{/condition}

I could also turn on it:
$smarty->set_condition('production');

or settings in configure file:

condition=production

don't you agree?
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 541

PostPosted: Tue Jul 07, 2009 10:16 am    Post subject: Reply with quote

I don't get how it's different than an if.

unless you are talking about some type of macro thing like C, in which the code is just not included at all.

either way, i'm not convinced it's needed.

Question
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Jul 08, 2009 2:44 am    Post subject: Reply with quote

Code:
$smarty->assign('production',true);


Code:
{if $production}...{/if}
Back to top
View user's profile Send private message Visit poster's website
yarco
Smarty Regular


Joined: 20 Mar 2009
Posts: 39

PostPosted: Wed Jul 08, 2009 3:30 am    Post subject: Reply with quote

1. That is just like switch/case vs if/else.
Although we could use if/else instead of switch/case, we still have switch/case keywords(in php).

2. The smarty kernel support
Quote:
or settings in configure file:

condition=production


If we do:
Quote:

$smarty->assign('production',true);
{if $production}...{/if}

Then the two logicals are mixed together. And we need to concern about the variable itself.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 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