[PHPTAL] Nested repeat
Tomas Sirny
tsirny at gmail.com
Tue Mar 27 08:36:24 CEST 2007
Hello, thanks a lot Justin and Levi, it helps. Now it behaves like I
want. I didn't realize that ending <li> tag end also that loop. Shame
on me:)
Tomas
On 3/26/07, Justin Fletcher <jyfletcher at gmail.com> wrote:
> 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
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL at lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
More information about the PHPTAL
mailing list