Having never actually tried this, I'm only about 99% sure that it will
work as "expected", which is -> the in child loop you will see the
child's counter - not the parent's counter.
Technically: the __counter__ is setup for each loop context -> the
"global_vars" thing which causes parent vars to be resolved inside the
loop, is resolved later in the output() phase and not in the parse()
phase which is where the __counter__ is set.
Your example is using a PARENT_LOOP_COUNTER - is that the name of the
variable, or was that meant to represent that you need access to the
parent's __counter__?
If it is a real variable, then your template should work as expected,
provided you use the "global_vars" option (as well as "loop_context_vars").
If PARENT_LOOP_COUNTER was just a way of explaining that you need access
to the parent's __counter__, then you are out of luck -> you will have
to find another way to do what you need.
Hope this helps,
Mathew
Michael Greenish wrote:
> Thanks, Mathew, for the response. That looks easy enough. Now, what
> if I have two nested tmpl_loops and I want to only apply the break tag
> on the first set of nested template loop date?
>
> For example:
>
> <tmpl_loop albums>
>
> <tmpl_loop pictures>
> ...
> <img src="<tmpl_var src>" alt="" />
> <tmpl_if expr="(__counter__ % 3) == 0 && PARENT_LOOP_COUNTER <
> 1"><br /></tmpl_if>
>
> </tmpl_loop>
> </tmpl_loop>
>
> Can I "see" the counter for the parent loop inside the child loop?
>
> Thanks.
>
> greanie
>
> ----- Original Message ----
> From: Mathew Robertson <[EMAIL PROTECTED]>
> To: Michael Greenish <[EMAIL PROTECTED]>
> Cc: html-template-users@lists.sourceforge.net
> Sent: Monday, April 30, 2007 7:31:07 PM
> Subject: Re: [htmltmpl] loop counting
>
> sure thing - but it does require using H::T::Expr. I use the
> following snippet as-is to a gallery of photo's. Notice the use of
> modulo (%).
>
> Mathew
>
> <table width=100% border=0 cellpadding=1 cellspacing=1>
> <TMPL_LOOP gallery>
> <TMPL_IF EXPR="(__counter__ % 3) == 1">
> <tr valign=top>
> </TMPL_IF>
> <td width=33% align=center valign=top class=text>
> <a href="<TMPL_VAR paths.gallery>/<TMPL_VAR
> NAME=filename ESCAPE=URL>" title="Click to enlarge"><img alt=""
> src="<TMPL_VAR paths.thumbnail>/<TMPL_VAR NAME=filename ESCAPE=URL>"
> width=180 height=200 border=0></a><br>
> <<TMPL_VAR spacer> width=10 height=6><br>
> <TMPL_VAR NAME=description ESCAPE=TEXT>
> </td>
> <TMPL_IF EXPR="(__counter__ % 3) == 0">
> </tr>
>
> <tr>
> <td colspan=3>
> <<TMPL_VAR spacer> height=18
> width=100%>
> </td>
> </tr>
> </TMPL_IF>
> </TMPL_LOOP>
> </table>
>
>
>
>
> Michael Greenish wrote:
>> Hello,
>>
>> I have a series of images that I would like to output but I want to limit it
>> to only 4 images per row. I would like to put a br tag to force the 5th,
>> 9th, etc... image to go to the next row. Can I do this completely int the
>> template using an iterator or resettable counter?
>>
>> Thanks,
>>
>> greanie
>>
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Html-template-users mailing list
>> Html-template-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/html-template-users
>>
>
>
> ------------------------------------------------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos.
> <http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM->
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Html-template-users mailing list
> Html-template-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/html-template-users
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users