On 16-12-2008 at 11:39:48 Nick Pack <n...@carbidefinger.net> wrote:
Sorry to dig up an old thread guys, I've been attempting to use Kornel's
code below but am getting an exception when there is not a third
dimension
array, for example:
<ul metal:define-macro="recursivelist" tal:condition="menu">
<li tal:repeat="l menu">${l/Title}
<tal:block tal:condition="l/Pages" tal:define="list l/Pages"
metal:use-macro="recursivelist" />
</li>
</ul>
Your macro uses menu variable for each level:
<li tal:repeat="l menu">
but you never change it:
tal:define="list l/Pages"
<tal:block metal:use-macro="recursivelist"/>
Using:
$this->view->menu = array('Title'=>'Section 1', 'Pages'=>array(
array('Title'=>'postgresql'),
array('Title' =>'test2')
)
);
Throws: 'PHPTAL_Exception' with message 'Unable to find part "Pages" in
path
"Pages" with base "Section 1"'
Am I missing something obvious?
tal:repeat="l menu" goes through elements of menu array, so variable l will
have content of menu['Title'].
You've probably ment:
$this->view->menu = array(array('Title'=>...
--
regards, Kornel
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal