Re: [htmltmpl] TMPL_LOOP limit or count
Brought to you by:
samtregar
From: David A. B. <dav...@gm...> - 2011-04-30 01:00:33
|
On Fri, Apr 29, 2011 at 16:45, vij...@gm... <vij...@gm...> 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 > vij...@gm... > > ----- Reply message ----- > From: "David A. Bandel" <dav...@gm...> > Date: Fri, Apr 29, 2011 17:28 > Subject: [htmltmpl] TMPL_LOOP limit or count > To: <htm...@li...> > > Folks, > > Been using HTML::Template in a few projects. Really nice not to have > HTML tangled in the Perl code. > > Got a largish hash I am sorting. Want to output only about 15 lines > of the table. Is there a way to tell the loop to stop? > > Here's what I'm doing: > > 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? > > 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. - Nemesis Air Racing Team motto Visit my web page at: http://david.bandel.us/ |