Thanks Kornel

On 16/12/2008 11:46, "Kornel Lesiński" <kor...@aardvarkmedia.co.uk> wrote:

> 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'=>...
> 

Nick Pack
Technical Services Manager


 
E: n...@carbidefinger.net
T: 0845 8128206
W: http://www.carbidefinger.net
 
Please do not send support enquiries directly to my email address, please
instead direct them to our automated tickets system at
supp...@carbidefinger.net to enable faster handling of your queries.

Company Details: Carbide-finger Limited, registered in England no.4388897.
Registered office: Weir Cottage, 2 Laindon Rd, Billericay, Essex CM12 9LD
Confidentiality: This e-mail and any attachments are intended for the
addressee only and may be confidential. If they have come to you in error
you must take no action based on them, nor must you copy or show them to
anyone; please reply to this e-mail and highlight the error. If you are not
the intended recipient, any disclosure, copying, distribution or any action
taken in reliance on its content is prohibited and may be unlawful. The
views expressed in this message are those of the individual sender and do
not necessarily represent the views of Carbide-Finger Limited.
Security: This e-mail and any attachments are believed to be free from any
virus but it is the responsibility of the recipient to ensure this is so.
E-mail is not a 100% secure communications medium. We recommend you observe
this when e-mailing us



_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to