Loop problems with new object support
| From: | David Heinemeier Hansson | Date: | Mon, 20 Jan 2003 17:56:49 +0000 |
| Subject: | Loop problems with new object support | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-564@lists.php.net to get a copy of this message | ||
Excellent to see some official support for objects in Smarty brewing! This has been my by far biggest gripe for my entire Smarty time.
It does seem like the new support has some problems with loops, though.
{$thread.methodReturningObjectArray whichArray="responses" assign="responses"}
{foreach from=$responses item=response}
<li>{$response.title}</li>
{/foreach}
{$response.title} doesn't access the right attribute, but {$response->title} does.
Also, it's slightly annoying that you have to do the foreach setup in two steps. I'd like {foreach from=$thread.methodReturningObjectArray("responses") item=response} much better. Is that just me?
How will this extension handle PHP 4.3.0's way of dereferencing? It would be very nice to be able to {$object.methodReturningOtherObject.otherObject.otherObjectAttribute}.
--
David Heinemeier Hansson
http://www.loudthinking.com/ -- Broadcasting Brain