Hi all,

I've got nested loops and I am using loop_context_vars, but when I reference
a context variable, it is using the outside loop.

[not the actual code, but you'll get the idea]

<TMPL_LOOP NAME=OUTSIDE>
        <TMPL_LOOP NAME=INSIDE>
                <TMPL_IF NAME=__FIRST__>
                        The stuff I want to show for the first element
                        of each element in the INSIDE list.
                </TMPL_IF>
        </TMPL_LOOP>
</TMPL_LOOP>

My data looks something like this:

{ 'OUTSIDE' => [
                        { 'INSIDE' => [
                                                { 'STUFF' => 1 } ,
                                                { 'STUFF' => 2 } ,
                                                { 'STUFF' => 3 } ] }
                        { 'INSIDE' => [
                                                { 'STUFF' => 4 } ,
                                                { 'STUFF' => 5 } ,
                                                { 'STUFF' => 6 } ] } ] }

When I print out the template, __FIRST__ is true when STUFF is equal to 1,
2, or 3, instead of when STUFF is equal to 1 and 4 (which is the first
element in each INSIDE list).

This is my constructor call:

$template = HTML::Template->new( filename => $filename ,
                                 loop_contact_vars => 1 ,
                                 die_on_bad_params => 0 ) ;

I am using HTML::Template 2.5. Any help is appreciated.

Thanks!
Kenny Smith
http://www.journalscape.com/kenny/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to