I have on page multilevel list menu. To done this menu, I make multilevel array. For max two level menu in phptal, this works:
       <li tal:repeat="menuItem menuItems">
<a tal:attributes="href php:isset(menuItem['url'])?menuItem['url']:'#'" tal:content="menuItem/name"/>
           <ul tal:condition="php:menuItem['type']=='menu'">
               <li tal:repeat="menuItem_2 menuItem/children">
<a tal:attributes="href php:isset(menuItem_2['url'])?menuItem_2['url']:'#'" tal:content="menuItem_2/name"/>

If element is url - I give this url to href, if this is menu - after <a> element i add <ul> list with children of this menu. But what, if I want to do such as menu without any limits of levels? One way to do it is to prepare string in php with this menu, by recursion function, and then put it in phptal with structure expression.
But is there some way to do it in phptal?


PHPTAL mailing list

Reply via email to