To make matters worse ... would there be a way to show something else on the 
last level ? 

I'd like to show a checkbox, but only for the items that don't have any child 
items. 



> 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