Is there any way to have a template where the number of columns is
determined at run time? I know how to use TMPL_LOOP but that only
lets me vary the number of rows.
What I'm doing is creating a template for SQL reports so I want a
structure like:
TMPL_LOOP NAME=SQL_OUTPUT
TMPL_IF
Yes, but it's not pretty...
TMPL_LOOP NAME=SQL_OUTPUT
TMPL_IF NAME=__first__
TR
TMPL_LOOP NAME=COLS
THHeaders go here/TH
/TMPL_LOOP
/TR
/TMPL_IF
TMPL_IF NAME=__odd__
TR
TMPL_LOOP NAME=COLS
TDRow of data in odd row color set/TD
/TMPL_LOOP
On Thu, May 15, 2008 at 12:21 PM, Joshua Miller [EMAIL PROTECTED] wrote:
Yes, but it's not pretty...
And it may be pretty slow for largish result sets.
You could also consider using client-side javascript to do the table
layout and sending the data as JSON, but that obviously adds a level
of
Hi Joshua
Let me know if the attachments don't come through and you want a copy.
No sign of attachments. Can you put them on your web site?
--
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html
# CGI::Application community mailing list
##
On Fri, May 16, 2008 at 2:03 AM, Stephen Carville
[EMAIL PROTECTED] wrote:
Is there any way to have a template where the number of columns is
determined at run time? I know how to use TMPL_LOOP but that only
lets me vary the number of rows.
I realize that you are using HTML::Template, and
Sure...
http://moc.rellimhsoj.com/perl/tmplloop_benchmark/
--
Josh I.
On Thu, May 15, 2008 at 7:07 PM, Ron Savage [EMAIL PROTECTED] wrote:
Hi Joshua
Let me know if the attachments don't come through and you want a copy.
No sign of attachments. Can you put them on your web site?
--
Ron
FWIW, I updated the benchmarks to include that one. While not as slow as the
nested loops in HTML::Template, it slower than the single loop in
HTML::Template.
http://moc.rellimhsoj.com/perl/tmplloop_benchmark/
Benchmark: timing 40 iterations of Templateloop, perl, tmpl1loop, tmpl2loops...
On Thu, May 15, 2008 at 9:03 AM, Stephen Carville
[EMAIL PROTECTED] wrote:
Is there any way to have a template where the number of columns is
determined at run time?
I don't know if this is a good idea, but you can use HTML::Template's
filter option to modify the template's content when it's
Based on some off-list suggestions, and some hunches, I added a few more
tests.
It has been expanded a little more to include HTML::Template,
HTML::Template::Pro, and TT, and versions that read from file and ones that
use a scalar variable to hold template data (to remove the file read from
the