Loop through items in object

Loop through items in object

Wednesday 28 June 2006 4:40:07 am - 1 reply

Author Message

Ɓukasz Serwatka

Monday 03 July 2006 11:30:09 pm

First you need to assing value to the TPL variable $myObject. In TPL define variable then in PHP use

$tpl->setVariable( 'myObject', $myObject );

Then you need to use:

{foreach $myObject[0] as $index => $value} 
   {$index} : {$value}
{/foreach}

or just

$tpl->setVariable( 'myObject', $myObject[0] );

then

{foreach $myObject as $index => $value} 
   {$index} : {$value}
{/foreach}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.