Re: TMPL_LOOP limit or count

"David A. Bandel" <[email protected]> Fri, 29 Apr 2011 20:00:26 -0500
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
On Fri, Apr 29, 2011 at 16:45, [email protected]
<[email protected]> wrote:
> Just a different way of thinking about it, but you could always output all
> the rows and use html/css to hide the ones after #15 or whatever. That way
> you're a bit more in keeping with data/presentation split that
> HTML::Template enforces...

Knew I was missing something.  Michael suggested in another post
HTML::Template::Expr, but I like the CSS method a little better.

Thanx.

>
> Vijay Krishna Ramesh
> [email protected]
>
> ----- Reply message -----
> From: "David A. Bandel" <[email protected]>
> Date: Fri, Apr 29, 2011 17:28
> Subject: [htmltmpl] TMPL_LOOP limit or count
> To: <[email protected]>
>
> Folks,
>
> Been using HTML::Template in a few projects. =A0Really nice not to have
> HTML tangled in the Perl code.
>
> Got a largish hash I am sorting. =A0Want to output only about 15 lines
> of the table. =A0Is there a way to tell the loop to stop?
>
> Here's what I'm doing:
>
> my @calloutdata;
> foreach $callskey ( sort {$callnum{$b} <=3D> $callnum{$a}} keys %callnum){
> =A0 =A0my %outbound;
> =A0 =A0$outbound{EXTENNUMCALLED} =A0=3D $callskey;
> =A0 =A0$outbound{TIMESCALLED} =A0 =A0 =A0=3D $callnum{$callskey};
> =A0 =A0push( @calloutdata, \%outbound );
> }
>
> =A0 =A0 =A0 =A0$template->param( OUTBOUNDS =3D> \@calloutdata );
>
> The calloutdata array winds up to be about 200 lines long. =A0Any way to
> have the TMPL_LOOP stop output after 15 or so table lines?
>
> Nothing in the docs suggests a way to do this (or am I missing something?=
).
>
[snip]


David A. Bandel
-- =

Focus on the dream, not the competition.
=A0 =A0 =A0 =A0 =A0 =A0 - Nemesis Air Racing Team motto
Visit my web page at: http://david.bandel.us/

---------------------------------------------------------------------------=
---
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