Hello,

I'm encoutering some strange behavior with my newest application. I have a
data structure that has three nested loops. I am trying to print data that
is in the first loop once I'm inside the third loop. I have global_vars
turned on, and the data is not showing. Here's the weird part... if I add
the given data to the template inside the first loop in addition to
displaying it inside the third loop, they both appear. It's the weirdest
thing. If I remove the TMPL_VAR from the first loop, then the TMPL_VAR in
the third loop shows up empty. Put it back, both display. Weird.

---- Template ----

    <!-- <TMPL_VAR NAME=CBP_ACT_NUM> if I include this comment, the
CBP_ACT_NUM shows inside the BILL_RATES loop... if I remove this comment,
the CBP_ACT_NUM does not show -->
    <TMPL_LOOP NAME=SERVER_IDS>
        <TMPL_LOOP NAME=YEARMONTHS>
            <TMPL_LOOP NAME=BILL_RATES>
                <tr>
                    <td><TMPL_VAR NAME=CBP_ACT_NUM></td>
                    <td><TMPL_VAR NAME=BILL_RATE></td>
                    <td><TMPL_VAR NAME=OVERLIMIT_HOURS></td>
                    <td><TMPL_VAR NAME=SUBTOTAL_TO_INVOICE></td>
                </tr>
            </TMPL_LOOP>
        </TMPL_LOOP>
    </TMPL_LOOP>

---- Data Structure Via Data Dumper ----

$VAR1 = [
   {
      'total_to_invoice' => 200,
      'cbp_act_num' => '000020011001147',
      'server_ids' => [
         {
            'yearmonths' => [
               {
                  'bill_rates' => [
                     {
                        'total_minutes' => 40,
                        'overlimit_hours' => 1,
                        'subtotal_to_invoice' => 200,
                        'total_hours' => 1,
                        'prepaid_hours' => undef,
                        'bill_rate' => 200
                     }
                  ],
                  'yearmonth' => '2002-03'
               }
            ],
            'server_id' => 19214
         }
      ]
   },
   { another entry simliar to the above... }
] ;


---- Code ----

    $d = Data::Dumper->new( \@report ) ;
    print STDERR $d->Dump() ;

    print CGI->header() ;
    $template = HTML::Template->new( filename => 'contractwork_report.tmpl'
,
                                     die_on_bad_params => 0 ,
                                     loop_context_vars => 1 ,
                                     global_vars => 1 ) ;
    $template->param( { 'ACCOUNTS' => \@report } ) ;
    print $template->output() ;


Any help?

Kenny Smith


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

Reply via email to