On 04/29/2011 05:28 PM, David A. Bandel wrote:
> my @calloutdata;
> foreach $callskey ( sort {$callnum{$b}<=> $callnum{$a}} keys %callnum){
> my %outbound;
> $outbound{EXTENNUMCALLED} = $callskey;
> $outbound{TIMESCALLED} = $callnum{$callskey};
> push( @calloutdata, \%outbound );
> }
>
> $template->param( OUTBOUNDS => \@calloutdata );
>
> The calloutdata array winds up to be about 200 lines long. Any way to
> have the TMPL_LOOP stop output after 15 or so table lines?
Well, the first thing I'd do is suggest that if possible you just don't
put all 200 things into the loop. That would save on your processing if
you didn't have to create the big loop to begin with.
But if you needed them in the loop in some places but didn't want to
display them in others, you can use the __counter__ loop context var
combined with HTML::Template::Expr.
<tmpl_loop outbounds>
<tmpl_if expr="__counter__ <= 15">
...
</tmpl_if>
</tmpl_loop>
> Nothing in the docs suggests a way to do this (or am I missing something?).
It's not possible with just HTML::Template, but HTML::Template::Expr
should help you get there.
--
Michael Peters
Plus Three, LP
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Html-template-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/html-template-users