None of the code at PerlMonks worked for me. At least, ones I the simplier ones.
Has anyone thought about doing HTML::Template::DBI? ----- Original Message ----- From: "Jim Lang" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 6:04 PM Subject: Re: [htmltmpl] HTML-Template and DBI > Doc I think I understand your confusion... > > Without doubt it was the PerlMonks tutorial at > http://perlmonks.thepen.com/65642.html > > that actually allowed me to use DBI and HTML::Template > together. > > But I still had a problem with this part: > > # prepare a data structure for HTML::Template > my $rows; > push @{$rows}, $_ while $_ = $sth->fetchrow_hashref(); > > # instantiate the template and substitute the values > my $template = HTML::Template->new(filename => 'songs.tmpl'); > $template->param(ROWS => $rows); > > > Yes, it got the data out and put it into the template, but > I didn't like the fact that I didnt have a value, lets say $title, > to use. See, I was used to doing a select, and then a while loop > in which I would output html, so I could just write html freely, > and have $column_name variables for the data output. This is pretty > much what you do inside the tmpl_loop. > > But you only see that in the template file. Again from the > PerlMonks tutorial at http://perlmonks.thepen.com/65642.html > > > <!-- songs.tmpl --> > <html> > <head> > <title>Song Listing</title> > </head> > <body> > <h1>My Songs</h1> > <table> > <!-- TMPL_LOOP NAME=ROWS --> > <tr> > <td><!-- TMPL_VAR NAME=TITLE --></td> > <td><!-- TMPL_VAR NAME=ARTIST --></td> > <td><!-- TMPL_VAR NAME=ALBUM --></td> > <td><!-- TMPL_VAR NAME=YEAR --></td> > </tr> > <!-- /TMPL_LOOP --> > </table> > </body> > </html> > > and there are your column names. > > But I still find this awkward sometimes when I would prefer to manipulate > the data prior to spitting it out to the template. I find myself resorting > to javascript when faced with this... I'm sure there is a better way. > > Well hopefully I've added something to the discussion besides more > confusion.. > > Jim > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Html-template-users mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/html-template-users ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users
