On Thu, 27 Sep 2012 17:10:39 +0000
Mark Haney <ma...@abemblem.com> wrote:

> >     my @rows_shift;
> >     while (my $row_shift = $sth->fetchrow_array() )
> >       {
> >       push @rows_shift, $row_shift;
> >       }

BTW, this is equivalent:

my $rows_shift = $sth->fetchall_arrayref();

And then instead of \@rows_shift, you pass $rows_shift to your $vars.

Similarly for the factories one, you could use this:

my $rows_factory = $sth->fetchall_arrayref({});

But you would also need to add aliases to your column names, so they
are named "id" and "abbr", or change the template to use their actual
column names.

TIMTOWTDI, of course!


> #The part where it gets passed to the HTML:
> 
> >     my $file = 'templates/shift_rpt.html';
> >     my $vars = {
> >     'cgi' =>CGI->new(),

You probably don't want to make a new CGI object here.  Try passing in
the one that's already made ($cgi).  I'm not entirely sure, but I think
when CGI does its parsing, it's destructive about it, so a second
object wouldn't necessarily get the same data.


> I've tried everything I can think of, but all it's doing is passing
> the name of the perl script (shift_rpt.pl) to the dropdown box.  The
> factory one works as advertised.  I just don't have a clue why one
> works and the other doesn't.

The name of the script is in $0.  But I don't see use of that variable
anywhere, and I can't imagine it would be accessible from the template.

As mentioned by others, it would help to see your call to process() and
the contents of the template...


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to