On 04-12-2008 at 09:34:03 a b <[EMAIL PROTECTED]> wrote:

Below is a sample of how I store and display in PHP tree structure stored in the database.
Can anybody tell me how  to rewrite this code into PHPTAL?
I assume, that I should use macro recurrency, but how to prepare array in
such case?

It would be best if you could turn it into a typical array of arrays (or nested objects):

$t->list = array(
        array('name'=>'sql', 'items'=>array(
                array('name'=>'postgresql', 'items'=>array(…)),
                array('name'=>'oracle', 'items'=>array(…)),

and then use:

<ul metal:define-macro="recursivelist" tal:condition="list">
        <li tal:repeat="l list">${l/name}
                <tal:block tal:define="list l/items" 
metal:use-macro="recursivelist" />

<tal:block metal:use-macro="recursivelist"/>

regards, Kornel

PHPTAL mailing list

Reply via email to