|
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 |
robert Smarty Rookie
Joined: 04 Mar 2009 Posts: 13
|
Posted: Mon Oct 26, 2009 4:13 am Post subject: syntax {$foo->function('string'.$var)} |
|
|
Hi
I'm calling a function on an object from smarty, and the argument is composed of a concatenated string like so:
{$foo->function('string'.$var)}
This, however doesn't seem to be supported. Is this intentional, and if so, how would the correct way be to go about doing this? |
|
Back to top |
|
yankee Smarty Rookie
Joined: 02 Mar 2009 Posts: 31
|
Posted: Mon Oct 26, 2009 12:41 pm Post subject: |
|
|
Concat is beeing done using "&" in smarty (not by using "."). |
|
Back to top |
|
robert Smarty Rookie
Joined: 04 Mar 2009 Posts: 13
|
Posted: Mon Oct 26, 2009 3:18 pm Post subject: |
|
|
Hi
I tried it out and & evaluates to logical AND.
The result is thus:
Code: | $_smarty_tpl->getVariable('foo')->value->function('string' & $_smarty_tpl->getVariable('variable')->value); |
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Oct 26, 2009 5:27 pm Post subject: |
|
|
Because of several requests the '&' has been redefined for backward compabillity to Smarty2 to the bit logical and operator.
For your case use:
{$foo->function("string`$var`")} |
|
Back to top |
|
robert Smarty Rookie
Joined: 04 Mar 2009 Posts: 13
|
Posted: Mon Oct 26, 2009 5:53 pm Post subject: |
|
|
Thanks! |
|
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
|