|
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 |
toycat Smarty Rookie
Joined: 29 Dec 2009 Posts: 8
|
Posted: Thu Jan 07, 2010 9:16 pm Post subject: missed that |
|
|
U.Tews wrote: | I don't see where the problem is. In Smarty3 you can use something like
$var['var2']->var3['var4']->var5...
or
$var.var2->var3.var4->var5...
So there should be no need for any typecasting.
{foreach} does already iterate over the properties of an object. |
My apologies, I somehow missed this. Tried it and works superb. Thank you. |
|
Back to top |
|
httpete Smarty Rookie
Joined: 05 Dec 2009 Posts: 27
|
Posted: Thu Jan 07, 2010 10:27 pm Post subject: New Error after latest update |
|
|
My previous error was fixed, but this started breaking after the latest update from SVN.
{if $smarty.request.showonlynew|strtolower eq 'on'}
needed to become:
{if strtolower($smarty.request.showonlynew) eq 'on'}
Is this expected? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Jan 08, 2010 3:41 pm Post subject: |
|
|
Some necessary parser changes did introduce a problem when using modifiers in if conditions or arithmetic expressions. A workround until this is fixed is to use parenthesis like
{if ($smarty.request.showonlynew|strtolower) eq 'on'} |
|
Back to top |
|
httpete Smarty Rookie
Joined: 05 Dec 2009 Posts: 27
|
Posted: Fri Jan 08, 2010 7:23 pm Post subject: |
|
|
Cool - I can wait as long as this is fixable, I am retrofitting a huge existing smarty 2 site, so I cannot change all the places. Please let me know when this is addressed. |
|
Back to top |
|
httpete Smarty Rookie
Joined: 05 Dec 2009 Posts: 27
|
Posted: Mon Jan 11, 2010 3:11 pm Post subject: New Bug? Nested object property accessors in smarty |
|
|
I found an interesting thing that broke when I upgraded to smarty 3. Accessing nested object properties doesn't work. Example:
$o = new stdClass;
$p = new stdClass;
$q = new stdClass;
$q->prop = 3;
$p->prop = $q
$o->prop = $p;
$smarty->assign('o' , $o);
if in smarty you go
{$o->prop->prop} you get "property undefined". One level depth seems to work fine.
I did the same thing with arrays and it worked fine. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Jan 11, 2010 5:01 pm Post subject: |
|
|
It does work fine at my place. Maybe you have had some misspelling.
But to get an output of 3 you need
{$o->prop->prop->prop} |
|
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
|