Marco,

thanks


It took my some time to figure out why this didn't work, untill I realised that 
I needed an extra <div metal:use-macro="list"/> to call the defined macro :s


Now, it works like a charm! 






Monday, May 3, 2010, 5:47:43 PM, you wrote:

> Use Macros!  

> <ul metal:define-macro="list" tal:define="listitems listitem">
>   <li tal:repeat="listitem listitems">
>     <ul metal:use-macro="list"/>
>   </li>
> </ul>

> This will generate nested <ul>'s assuming that every "listitem" is an array 
> of 0 or more arrays
> Marco Pivetta - Ocramius Aethril
> http://twitter.com/Ocramius


> 2010/5/3 GRolf <ger...@pictureparking.com>


> Is there a way to print an <ul><li> tree recursively with PHPTal, that
> is, without knowing the exact number of levels in my associative array


> Say I have

$phptal->>myarray = Array
> (
>    [bar] =>
>    [baz] => Array
>        (
>            [bop] => Array
>                (
>                    [0] => file4.txt
>                )

>            [0] => file2.txt
>            [1] => file3.txt
>        )

>    [0] => file1.txt
> )

> and I'd like to produce:

> <ul>
>        <li>Bar</li>
>        <li>Baz
>                <ul>
>                        <li>Bop
>                                <ul>
>                                        <li>File4.txt</li>
>                                </ul>
>                        </li>
>                        <li>file2.txt</li>
>                        <li>file3.txt</li>
>                </ul>
>        <li>file1.txt</li>
> </ul>





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


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

Reply via email to