Hello

I'm using global_vars but it does seem to work unless I referece the variable
in their outer level scope. By this I mean if I have loop A and loop B within
loop A the variable from conext A only appear in cointext B if they were
referenced in context A

using this code

my $template = HTML::Template->new(
        filename => 'testfile',
        die_on_bad_params => 0,
        global_vars => 1,
        loop_context_vars => 1
);

push @INNER_LOOP, { INNER_VAR => 'this is inner var' };
push @OUTER_LOOP, { OUTER_VAR => 'this is outer var', INNER_LOOP =>
\@INNER_LOOP };
$template->param( OUTER_LOOP => \@OUTER_LOOP );
print $template->output();

-----

and taking the manual page example

<TMPL_LOOP OUTER_LOOP>
 OUTER: <TMPL_VAR OUTER_VAR>
   <TMPL_LOOP INNER_LOOP>
      INNER: <TMPL_VAR INNER_VAR>
      INSIDE OUT: <TMPL_VAR OUTER_VAR>
   </TMPL_LOOP>
</TMPL_LOOP>

gives the expected

 OUTER: this is outer var

      INNER: this is inner var
      INSIDE OUT: this is outer var


however if I don't refer to OUTER_VAR in the OUTER_LOOP then INNER_LOOP
doesn't get it either i.e.

<TMPL_LOOP OUTER_LOOP>
   <TMPL_LOOP INNER_LOOP>
      INNER: <TMPL_VAR INNER_VAR>
      INSIDE OUT: <TMPL_VAR OUTER_VAR>
   </TMPL_LOOP>
</TMPL_LOOP>

gives

      INNER: this is inner var
      INSIDE OUT:


is this a bug?

TIA,

Neil


p.s.
<TMPL_LOOP OUTER_LOOP>
   <TMPL_LOOP INNER_LOOP>
      INNER: <TMPL_VAR INNER_VAR>
      INSIDE OUT: <TMPL_VAR OUTER_VAR>
   </TMPL_LOOP>
 OUTER: <TMPL_VAR OUTER_VAR>
</TMPL_LOOP>

works fine




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to