|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Karel S. Smarty Rookie
Joined: 03 Aug 2009 Posts: 26 Location: The Netherlands
|
Posted: Tue Sep 01, 2009 2:04 pm Post subject: Smarty 3 and constants |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Sep 01, 2009 4:37 pm Post subject: |
|
|
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 |
|
nielsNL Smarty Rookie
Joined: 03 May 2009 Posts: 17
|
Posted: Tue Sep 01, 2009 8:17 pm Post subject: |
|
|
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 |
|
|
|
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
|