[PHPTAL] Nested repeat

Justin Fletcher jyfletcher at gmail.com
Mon Mar 26 21:16:55 CEST 2007


On Mon, 26 Mar 2007 14:42:04 +0200, Tomas Sirny <tsirny at gmail.com> wrote:
> My code (test.html):
> <ul >
>     <li tal:repeat="item archive">
>         <a tal:attributes="href item/href"  
> tal:content="item/text">Link</a>
>     </li>
>     <ul>
>         <li tal:repeat="subitem item/subitem">
>             <a tal:attributes="href subitem/href"
> tal:content="subitem/text">Sublink</a>
>         </li>
>     </ul>
> </ul>
>

You are running the first loop and then the 2nd afterword... functionally  
this:
for() {};
for() {};

rather than:
for() { for() {}; };

The 'item' variable in your second loop should be out of scope (a bug  
perhaps?).

Try something like this:
<ul>
   <span tal:repeat="item archive" tal:omit-tag="">
     <li>
       <a tal:attributes="href item/href" tal:content="item/text">Link</a>
     </li>
     <ul>
       <li tal:repeat="subitem item/subitem">
         <a tal:attributes="href subitem/href"  
tal:content="subitem/text">Sublink</a>
       </li>
     </ul>
   </span>
</ul>


>
> Thanks for any help.
> Tomas
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL at lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal


Hope that helps,
-Justin



More information about the PHPTAL mailing list