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

Smarty 3 and constants

 
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  
Author Message
Karel S.
Smarty Rookie


Joined: 03 Aug 2009
Posts: 26
Location: The Netherlands

PostPosted: Tue Sep 01, 2009 2:04 pm    Post subject: Smarty 3 and constants Reply with quote

In Smarty 3, this syntax does not work anymore:

Code:

define('FOO', 5);

$smarty->assign ( 'test', 5 );

{if $test == FOO}
//do something
{/if}


You must use this:

Code:

{if $test == $smarty.const.FOO}
//do something
{/if}


Not a big problem, just wondering if this is a bug or feature?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Sep 01, 2009 4:37 pm    Post subject: Reply with quote

This is a feature.

In Smarty2 there is an ambiguity as in {assign var=FOO value=1} is interpreted as string 'FOO'.

In Smarty3 FOO ia always be interpreted as a sting.
Back to top
View user's profile Send private message
nielsNL
Smarty Rookie


Joined: 03 May 2009
Posts: 17

PostPosted: Tue Sep 01, 2009 8:17 pm    Post subject: Reply with quote

About constands I did made a hack to the smarty2 version that alows us to get the define as !define! insteed of $smarty.const.FOO.

Is it posible to add this in Smarty3 too?

btw: I can send to you the changes when you want
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