html-template-users Mailing List for HTML::Template (Page 65)
Brought to you by:
samtregar
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(42) |
Jul
(80) |
Aug
(77) |
Sep
(97) |
Oct
(65) |
Nov
(80) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(63) |
Feb
(47) |
Mar
(45) |
Apr
(63) |
May
(67) |
Jun
(51) |
Jul
(78) |
Aug
(37) |
Sep
(45) |
Oct
(59) |
Nov
(50) |
Dec
(70) |
2004 |
Jan
(23) |
Feb
(90) |
Mar
(37) |
Apr
(53) |
May
(111) |
Jun
(71) |
Jul
(35) |
Aug
(58) |
Sep
(35) |
Oct
(35) |
Nov
(35) |
Dec
(20) |
2005 |
Jan
(51) |
Feb
(19) |
Mar
(20) |
Apr
(8) |
May
(26) |
Jun
(14) |
Jul
(49) |
Aug
(24) |
Sep
(20) |
Oct
(49) |
Nov
(17) |
Dec
(53) |
2006 |
Jan
(12) |
Feb
(26) |
Mar
(45) |
Apr
(19) |
May
(19) |
Jun
(13) |
Jul
(11) |
Aug
(9) |
Sep
(10) |
Oct
(16) |
Nov
(17) |
Dec
(13) |
2007 |
Jan
(9) |
Feb
(12) |
Mar
(28) |
Apr
(33) |
May
(12) |
Jun
(12) |
Jul
(19) |
Aug
(4) |
Sep
(4) |
Oct
(5) |
Nov
(5) |
Dec
(13) |
2008 |
Jan
(6) |
Feb
(7) |
Mar
(14) |
Apr
(16) |
May
(3) |
Jun
(1) |
Jul
(12) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
(9) |
Feb
|
Mar
(10) |
Apr
(1) |
May
|
Jun
(6) |
Jul
(5) |
Aug
(3) |
Sep
(7) |
Oct
(1) |
Nov
(15) |
Dec
(1) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(3) |
Mar
|
Apr
(28) |
May
|
Jun
|
Jul
(3) |
Aug
(4) |
Sep
(3) |
Oct
|
Nov
(8) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Mathew R. <mat...@re...> - 2003-11-20 01:24:40
|
> The new template file looks like: >=20 > <TMPL_LOOP ROWS> > <br> > <br> > <TMPL_VAR NAME=3DMODEL_NAME> > <br> > <img src=3D"<TMPL_VAR NAME=3DMODEL_THUMB>" border=3D0 height=3D100 = width=3D100> > <br> > Can be seen at: >=20 > <TMPL_LOOP URLLOOP> > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > Model Comp: <TMPL_VAR NAME=3DMODEL_COMP> >=20 > <TMPL_IF EXPR=3DMODEL_COMP eq MODEL_NAME"> > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > Model Comp: <TMPL_VAR NAME=3DMODEL_COMP> > The URL on match: <TMPL_VAR NAME=3DMODEL_URL> > </TMPL_IF> > </TMPL_LOOP> >=20 > </TMPL_LOOP> > <br> It looks like you are missing a " after the EXPR ...? Mat |
From: Karen J. C. <si...@ph...> - 2003-11-20 01:24:36
|
On Wed, 19 Nov 2003, Chris wrote: C>HTML::Template->new() : Syntax error in <TMPL_*> tag at index.tmpl : 14. C>at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243. C> C>Yes, I am using use HTML::Template::Expr; in my perl script and it is the C>newest version. Wouldn't that error be HTML::Template::Expr->new() if you're using Expr? (I haven't used Expr, myself, so I could be wrong.) -- Karen J. Cravens si...@ph... |
From: Chris <chr...@co...> - 2003-11-20 01:11:18
|
Hi Matt, Thank you so much for the reply. I had tried that, and that change yeilds the following error: HTML::Template->new() : Syntax error in <TMPL_*> tag at index.tmpl : 14. at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243. Yes, I am using use HTML::Template::Expr; in my perl script and it is the newest version. The new template file looks like: <TMPL_LOOP ROWS> <br> <br> <TMPL_VAR NAME=MODEL_NAME> <br> <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 width=100> <br> Can be seen at: <TMPL_LOOP URLLOOP> Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME=MODEL_COMP> <TMPL_IF EXPR=MODEL_COMP eq MODEL_NAME"> Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME=MODEL_COMP> The URL on match: <TMPL_VAR NAME=MODEL_URL> </TMPL_IF> </TMPL_LOOP> </TMPL_LOOP> <br> with the updated "EXPR" Thanks!!! > -----Original Message----- > From: Mathew Robertson [mailto:mat...@re...] > Sent: Wednesday, November 19, 2003 7:28 PM > To: Chris; htm...@li... > Subject: Re: [htmltmpl] Comparing H::T:Expr variables > > > > > I seems that when I call: > > > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > Model Comp: <TMPL_VAR NAME="MODEL_COMP"> > > > > from within: <TMPL_LOOP URLLOOP> > > > > It prints the correct data. > > > > Now.. Since that works, am I just using the: > > > > <TMPL_IF NAME="MODEL_COMP eq MODEL_NAME"> > > > > Statement WRONG? The data between the IF statement never gets displayed. > > Yep, you need to use <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME"> > > Note the "EXPR". > > That should fix it... > > Mathew |
From: Mathew R. <mat...@re...> - 2003-11-20 00:29:34
|
> I seems that when I call: >=20 > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > Model Comp: <TMPL_VAR NAME=3D"MODEL_COMP"> >=20 > from within: <TMPL_LOOP URLLOOP> >=20 > It prints the correct data. >=20 > Now.. Since that works, am I just using the: >=20 > <TMPL_IF NAME=3D"MODEL_COMP eq MODEL_NAME"> >=20 > Statement WRONG? The data between the IF statement never gets = displayed. Yep, you need to use <TMPL_IF EXPR=3D"MODEL_COMP eq MODEL_NAME"> Note the "EXPR". That should fix it... Mathew |
From: Chris <chr...@co...> - 2003-11-19 23:48:42
|
Hi All, Quick question for you. Iv got the following template: <TMPL_LOOP ROWS> <br> <br> <TMPL_VAR NAME=MODEL_NAME> <br> <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 width=100> <br> Can be seen at: <TMPL_LOOP URLLOOP> Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME="MODEL_COMP"> <TMPL_IF NAME="MODEL_COMP eq MODEL_NAME"> Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME="MODEL_COMP"> The URL on match: <TMPL_VAR NAME=MODEL_URL> </TMPL_IF> </TMPL_LOOP> </TMPL_LOOP> <br> I seems that when I call: Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME="MODEL_COMP"> from within: <TMPL_LOOP URLLOOP> It prints the correct data. Now.. Since that works, am I just using the: <TMPL_IF NAME="MODEL_COMP eq MODEL_NAME"> Statement WRONG? The data between the IF statement never gets displayed. Thanks so much! |
From: Isaac <is...@vi...> - 2003-11-18 18:21:43
|
I think see where the snafu is now.; I gotta touch it to see. ;) Thanks for your help guys.. it was a stupid mistake. Isaac On 11/18/03 6:33 AM, "Puneet Kishor" <pk...@ei...> wrote: > As others mentioned, your error message has nothing to do with your > diagnosis of it (and vice versa). > > The error message is saying -- "Hey Isaac, tihs is your program > speaking -- you defined a parameter called 'recordexpire' in your > script, however, I can find no corresponding variable to populate in > your template. I am croaking..." > > To fix this do one of two things -- either make sure that there is a > variable in your template for _every_ parameter in your script OR set > die_on_bad_params => 0 in your script. > > Now wrt your diagnosis of the message -- to date neither have I nor > anyone else come across H::T croaking because of less or more or all of > the records in the database accessed. > > Hope this helps. > > > On Nov 18, 2003, at 5:39 AM, Isaac wrote: > >> Hullo everyone.. I just started using HTML::Template and I still think >> the >> sky is the limit. ;) >> >> The problem I'm having is HTML::Template choking unless I access all >> the >> records in the database from a single parse. >> >> I've run into a problem with HTML::Template not wanting to let records >> go to >> waste. I've got a modest database and I'm very unfamiliar with >> HTML::Template, but I'd like to know if there's a way around this? Not >> every >> database will be fully populated, but I want to have my maintenance & >> statistics scripts go in plot growth occasionally. >> >> Error message.. >>> HTML::Template->output() : fatal error in loop output : >>> HTML::Template : >>> Attempt to set nonexistent parameter 'recordexpire' - this parameter >>> name >>> doesn't match any declarations in the template file : >>> (die_on_bad_params => 1) >>> at ../shared//Template.pm line 2905 >> >> TIA, >> Isaac - Internet & Marketing, Vancouver Island News Group >> >> >> >> ------------------------------------------------------- >> This SF. Net email is sponsored by: GoToMyPC >> GoToMyPC is the fast, easy and secure way to access your computer from >> any Web browser or wireless device. Click here to Try it Free! >> https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/ >> g22lp.tmpl >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > ------------------------------------------------------- > This SF. Net email is sponsored by: GoToMyPC > GoToMyPC is the fast, easy and secure way to access your computer from > any Web browser or wireless device. Click here to Try it Free! > https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Puneet K. <pk...@ei...> - 2003-11-18 14:38:29
|
As others mentioned, your error message has nothing to do with your diagnosis of it (and vice versa). The error message is saying -- "Hey Isaac, tihs is your program speaking -- you defined a parameter called 'recordexpire' in your script, however, I can find no corresponding variable to populate in your template. I am croaking..." To fix this do one of two things -- either make sure that there is a variable in your template for _every_ parameter in your script OR set die_on_bad_params => 0 in your script. Now wrt your diagnosis of the message -- to date neither have I nor anyone else come across H::T croaking because of less or more or all of the records in the database accessed. Hope this helps. On Nov 18, 2003, at 5:39 AM, Isaac wrote: > Hullo everyone.. I just started using HTML::Template and I still think > the > sky is the limit. ;) > > The problem I'm having is HTML::Template choking unless I access all > the > records in the database from a single parse. > > I've run into a problem with HTML::Template not wanting to let records > go to > waste. I've got a modest database and I'm very unfamiliar with > HTML::Template, but I'd like to know if there's a way around this? Not > every > database will be fully populated, but I want to have my maintenance & > statistics scripts go in plot growth occasionally. > > Error message.. >> HTML::Template->output() : fatal error in loop output : >> HTML::Template : >> Attempt to set nonexistent parameter 'recordexpire' - this parameter >> name >> doesn't match any declarations in the template file : >> (die_on_bad_params => 1) >> at ../shared//Template.pm line 2905 > > TIA, > Isaac - Internet & Marketing, Vancouver Island News Group > > > > ------------------------------------------------------- > This SF. Net email is sponsored by: GoToMyPC > GoToMyPC is the fast, easy and secure way to access your computer from > any Web browser or wireless device. Click here to Try it Free! > https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/ > g22lp.tmpl > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Joel <htm...@jo...> - 2003-11-18 13:15:09
|
Isaac, I agree with Roger. The error you describe is exactly what it says: you're trying to set a parameter that doesn't exist (inside your TMPL_LOOP, presumably) As for the situation with accessing all rows in the database, that could be something different. Can you give us a sample of your code (perl as well as HTML) so we can see what's going on? (Something makes me think that the error you mentioned is not related your your comment about having to access all rows in a query.) --Joel >On Tue, Nov 18, 2003 at 03:39:29AM -0800, Isaac wrote: > >>The problem I'm having is HTML::Template choking unless I access all the >>records in the database from a single parse. > >It's not at all clear what you mean by this. > >But the usual fix for this error message: > >>> HTML::Template->output() : fatal error in loop output : HTML::Template : >>> Attempt to set nonexistent parameter 'recordexpire' - this parameter name >>> doesn't match any declarations in the template file : (die_on_bad_params => 1) > >is to set die_on_bad_params to 0. > >Roger > |
From: Roger B. W. <ro...@fi...> - 2003-11-18 11:42:29
|
On Tue, Nov 18, 2003 at 03:39:29AM -0800, Isaac wrote: >The problem I'm having is HTML::Template choking unless I access all the >records in the database from a single parse. It's not at all clear what you mean by this. But the usual fix for this error message: >> HTML::Template->output() : fatal error in loop output : HTML::Template : >> Attempt to set nonexistent parameter 'recordexpire' - this parameter name >> doesn't match any declarations in the template file : (die_on_bad_params => 1) is to set die_on_bad_params to 0. Roger |
From: Isaac <is...@vi...> - 2003-11-18 11:39:43
|
Hullo everyone.. I just started using HTML::Template and I still think the sky is the limit. ;) The problem I'm having is HTML::Template choking unless I access all the records in the database from a single parse. I've run into a problem with HTML::Template not wanting to let records go to waste. I've got a modest database and I'm very unfamiliar with HTML::Template, but I'd like to know if there's a way around this? Not every database will be fully populated, but I want to have my maintenance & statistics scripts go in plot growth occasionally. Error message.. > HTML::Template->output() : fatal error in loop output : HTML::Template : > Attempt to set nonexistent parameter 'recordexpire' - this parameter name > doesn't match any declarations in the template file : (die_on_bad_params => 1) > at ../shared//Template.pm line 2905 TIA, Isaac - Internet & Marketing, Vancouver Island News Group |
From: Kenneth G. <la...@th...> - 2003-11-18 03:50:56
|
On Monday 17 November 2003 23:57, Chris wrote: > Thanks for the link, it helped me very much! > > Now once again im stuck... > > How do I do nested loops?? > > Using the perlmonks example: > > <TMPL_LOOP ROWS> > <tr bgcolor="#<TMPL_IF ODD>666666<TMPL_ELSE>EEEEEE</TMPL_IF>"> > <td><TMPL_VAR NAME=ID></td> > <td><TMPL_VAR NAME=NAME></td> > <td><TMPL_VAR NAME=PRICE></td> > </tr> > </TMPL_LOOP> > > If I wanted to do say: > > <TMPL_LOOP ROWS> > <tr bgcolor="#<TMPL_IF ODD>666666<TMPL_ELSE>EEEEEE</TMPL_IF>"> > <td><TMPL_VAR NAME=ID></td> > <TMPL_LOOP INNERROWS> > <TMPL_VAR NAME=SUBID> > </TMPL_LOOP> > <td><TMPL_VAR NAME=NAME></td> > <td><TMPL_VAR NAME=PRICE></td> > </tr> > </TMPL_LOOP> > > > For the life of me, I can't figure out how to do it... > > I have repeatedly destroyed my own code, so I will use the perlmonks > code.. > > This is what I have been trying, is it even *close* to right??? > > while ($sth->fetch) { > my $real_price = $price < $saleprice ? $price : $saleprice; > $name =~ s/\b(\w)(\w+)\b/\U$1\L$2/g; > push @rows, { ID => lc($id), PRICE => $real_price, NAME => $name, > +ODD => $i++ %2 }; > $sum += $real_price; > while ($sth2->fetch) { > push @innerrows, { SUBID => $sub_id }; > } > } @innerrows should be pushed into @rows -- regards kg http://www.ootygolfclub.org |
From: Jayson P. <JP...@je...> - 2003-11-17 21:13:11
|
Ken: You need to refer to the inner loop as an array reference within the data hierarchy of the first loop. Currently you have them both on the same level. Try this code: #!/usr/bin/perl use DBI; use CGI; use HTML::Template; my $dbsource =3D "DBI:mysql:dbname=3Dmsearch;host=3Dlocalhost"; my $dbuser =3D "chrisp"; my $dbpasswd =3D "cockfuck"; my $template =3D HTML::Template->new(filename =3D> 'index.tmpl'); my $bychar =3D 'c'; my @URLS =3D (); my @ROWS =3D (); my $dbh =3D DBI->connect($dbsource, $dbuser, $dbpasswd); ## Query 1 my $sth =3D $dbh=3D>prepare("SELECT model=5Furl FROM models where model=5Fna= me =3D =3F"); $sth->execute('Christine'); while(my $data =3D $sth->fetchrow=5Fhashref) { push (@URLS, { MODEL=5FURL =3D> $data->{model=5Furl} }); ## Store info f= rom first query } $sth->finish(); ## Query 2 $sth =3D $dbh->prepare("SELECT DISTINCT model=5Fname as model=5Fname, model=5Fthumb FROM models WHERE model=5Ffirstchar =3D =3F GROUP BY model=5Fn= ame"); $sth->execute($bychar) || die &error($DBI::errstr); while (my $data =3D $sth->fetchrow=5Fhashref) { push (@ROWS, { MODEL=5FNAME =3D> $data->{model=5Fname}, MODEL=5FTHUMB =3D> $data->{model=5Fthumb}, URLLOOP =3D> \@URLS, }); } $sth->finish(); $template->param( ROWS =3D> \@ROWS ); print $template->output; --Jayson "Chris" <chr...@co...> Sent by: htm...@li... 11/17/03 03:40 PM To: "Kenneth Gonsalves" <la...@th...>, <htm...@li...> cc: Subject: RE: [htmltmpl] MySQL -> HTML::Template - WITH source= Hey, Here is a "working" example of what im trying to do: Perl Code: #!/usr/bin/perl use DBI; use CGI; use HTML::Template; my $dbsource =3D "DBI:mysql:dbname=3Dmsearch;host=3Dlocalhost"; my $dbuser =3D "chrisp"; my $dbpasswd =3D "cockfuck"; my $template =3D HTML::Template->new(filename =3D> 'index.tmpl'); my $bychar =3D "c"; my $dbh =3D DBI->connect($dbsource, $dbuser, $dbpasswd); my $query =3D "SELECT DISTINCT model=5Fname as model=5Fname, model=5Fthumb F= ROM models WHERE model=5Ffirstchar=3D'$bychar' GROUP BY model=5Fname"; my $sth =3D $dbh->prepare($query); $sth->execute() || die &error($DBI::errstr); my $dbh2 =3D DBI->connect($dbsource, $dbuser, $dbpasswd); my $query2 =3D "SELECT model=5Furl FROM models where model=5Fname =3D 'Christine'"; my $sth2 =3D $dbh2->prepare($query2); while (my $data =3D $sth->fetchrow=5Fhashref()) { push (@loopdata, $data); $sth2->execute() || die &error($DBI::errstr); while (my $data2 =3D $sth2->fetchrow=5Fhashref()) { push(@loopdata2, $data2); } } $template->param('URLLOOP' =3D> \@loopdata2, 'ROWS' =3D> \@loopdata); print $template->output; My HTML Template - WORKING BUT UNWANTED RESULTS: <TMPL=5FLOOP ROWS> <TMPL=5FVAR NAME=3DMODEL=5FNAME> <TMPL=5FVAR NAME=3DMODEL=5FTHUMB> Can be seen at: </TMPL=5FLOOP> <TMPL=5FLOOP URLLOOP> <TMPL=5FVAR NAME=3DMODEL=5FURL> </TMPL=5FLOOP> My HTML Template - THAT I WANT TO WORK: <TMPL=5FLOOP ROWS> <TMPL=5FVAR NAME=3DMODEL=5FNAME> <TMPL=5FVAR NAME=3DMODEL=5FTHUMB> Can be seen at: <TMPL=5FLOOP URLLOOP> <TMPL=5FVAR NAME=3DMODEL=5FURL> </TMPL=5FLOOP> </TMPL=5FLOOP> <br> It seems once i put the loop within the loop, I get the following error: HTML::Template : Attempt to set nonexistent parameter 'urlloop' - this parameter name doesn't match any declarations in the template file : (die=5Fon=5Fbad=5Fparams =3D> 1) at test.pl line 36 Im really not sure what to do here Thanks! > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of > Chris > Sent: Monday, November 17, 2003 1:28 PM > To: Kenneth Gonsalves; htm...@li... > Subject: RE: [htmltmpl] MySQL -> HTML::Template > > > Thanks for the link, it helped me very much! > > Now once again im stuck... > > How do I do nested loops=3F=3F > > Using the perlmonks example: > > <TMPL=5FLOOP ROWS> > <tr bgcolor=3D"#<TMPL=5FIF ODD>666666<TMPL=5FELSE>EEEEEE</TMPL=5FIF>">= > <td><TMPL=5FVAR NAME=3DID></td> > <td><TMPL=5FVAR NAME=3DNAME></td> > <td><TMPL=5FVAR NAME=3DPRICE></td> > </tr> > </TMPL=5FLOOP> > > If I wanted to do say: > > <TMPL=5FLOOP ROWS> > <tr bgcolor=3D"#<TMPL=5FIF ODD>666666<TMPL=5FELSE>EEEEEE</TMPL=5FIF>">= > <td><TMPL=5FVAR NAME=3DID></td> > <TMPL=5FLOOP INNERROWS> > <TMPL=5FVAR= NAME=3DSUBID> > </TMPL=5FLOOP> > <td><TMPL=5FVAR NAME=3DNAME></td> > <td><TMPL=5FVAR NAME=3DPRICE></td> > </tr> > </TMPL=5FLOOP> > > > For the life of me, I can't figure out how to do it... > > I have repeatedly destroyed my own code, so I will use the perlmonks > code.. > > This is what I have been trying, is it even *close* to right=3F=3F=3F > > while ($sth->fetch) { > my $real=5Fprice =3D $price < $saleprice =3F $price : $saleprice; > $name =3D~ s/\b(\w)(\w+)\b/\U$1\L$2/g; > push @rows, { ID =3D> lc($id), PRICE =3D> $real=5Fprice, NAME =3D> $na= me, > +ODD =3D> $i++ %2 }; > $sum +=3D $real=5Fprice; > while ($sth2->fetch) { > push @innerrows, { SUBID =3D> $sub=5Fid }; > } > } > > $sth->finish; > $sth2->finish; > > my $t =3D HTML::Template->new(filename =3D> 'db2.tmpl', @tmpl=5Fopts); > $t->param(ROWS =3D> \@rows, INNERROWS =3D> \@innerrows); > > I know this isn't my code, but like I said, iv destroyed mine over and > over.. But this gives you the idea of what iv been trying, each time with > failure. > > Any help is very much appreciated as I am very frustrated :) > > Thx! > -c > > > > -----Original Message----- > > From: htm...@li... > > [mailto:htm...@li...]On Behalf Of > > Kenneth Gonsalves > > Sent: Sunday, November 16, 2003 2:38 AM > > To: Chris; htm...@li... > > Subject: Re: [htmltmpl] MySQL -> HTML::Template > > > > > > On Sunday 16 November 2003 12:17, Chris wrote: > > > Hey all, > > > > > > Im new to HTML:Template, and it looks pretty nice, but I > > have not seen > > > anything related to using MySQL output. Basically all I really > > want to do > > > is be able to give my web designers tags like: %%SEARCH=5FRESULTS%% > which > > > when the page is parsed by my cgi using HTML:Template will > > recieve my sql > > > results. Is anybody doing this=3F > > > > > > Any pointers very much appreciated:) > > > -c > > there is a very nice tutorial on this in perlmonks.org > > -- > > regards > > kg > > > > http://www.ootygolfclub.org > > > > > > ------------------------------------------------------- > > This SF. Net email is sponsored by: GoToMyPC > > GoToMyPC is the fast, easy and secure way to access your computer from > > any Web browser or wireless device. Click here to Try it Free! > > https://www.gotomypc.com/tr/OSDN/AW/Q4=5F2003/t/g22lp=3FTarget=3Dmm/g22lp.tm= pl > > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users > Jefferies archives and reviews outgoing and incoming e-mail. It may be prod= uced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a resu= lt of transmission. Use by other than intended recipients is prohibited. |
From: Chris <chr...@co...> - 2003-11-17 20:41:33
|
Hey, Here is a "working" example of what im trying to do: Perl Code: #!/usr/bin/perl use DBI; use CGI; use HTML::Template; my $dbsource = "DBI:mysql:dbname=msearch;host=localhost"; my $dbuser = "chrisp"; my $dbpasswd = "cockfuck"; my $template = HTML::Template->new(filename => 'index.tmpl'); my $bychar = "c"; my $dbh = DBI->connect($dbsource, $dbuser, $dbpasswd); my $query = "SELECT DISTINCT model_name as model_name, model_thumb FROM models WHERE model_firstchar='$bychar' GROUP BY model_name"; my $sth = $dbh->prepare($query); $sth->execute() || die &error($DBI::errstr); my $dbh2 = DBI->connect($dbsource, $dbuser, $dbpasswd); my $query2 = "SELECT model_url FROM models where model_name = 'Christine'"; my $sth2 = $dbh2->prepare($query2); while (my $data = $sth->fetchrow_hashref()) { push (@loopdata, $data); $sth2->execute() || die &error($DBI::errstr); while (my $data2 = $sth2->fetchrow_hashref()) { push(@loopdata2, $data2); } } $template->param('URLLOOP' => \@loopdata2, 'ROWS' => \@loopdata); print $template->output; My HTML Template - WORKING BUT UNWANTED RESULTS: <TMPL_LOOP ROWS> <TMPL_VAR NAME=MODEL_NAME> <TMPL_VAR NAME=MODEL_THUMB> Can be seen at: </TMPL_LOOP> <TMPL_LOOP URLLOOP> <TMPL_VAR NAME=MODEL_URL> </TMPL_LOOP> My HTML Template - THAT I WANT TO WORK: <TMPL_LOOP ROWS> <TMPL_VAR NAME=MODEL_NAME> <TMPL_VAR NAME=MODEL_THUMB> Can be seen at: <TMPL_LOOP URLLOOP> <TMPL_VAR NAME=MODEL_URL> </TMPL_LOOP> </TMPL_LOOP> <br> It seems once i put the loop within the loop, I get the following error: HTML::Template : Attempt to set nonexistent parameter 'urlloop' - this parameter name doesn't match any declarations in the template file : (die_on_bad_params => 1) at test.pl line 36 Im really not sure what to do here Thanks! > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of > Chris > Sent: Monday, November 17, 2003 1:28 PM > To: Kenneth Gonsalves; htm...@li... > Subject: RE: [htmltmpl] MySQL -> HTML::Template > > > Thanks for the link, it helped me very much! > > Now once again im stuck... > > How do I do nested loops?? > > Using the perlmonks example: > > <TMPL_LOOP ROWS> > <tr bgcolor="#<TMPL_IF ODD>666666<TMPL_ELSE>EEEEEE</TMPL_IF>"> > <td><TMPL_VAR NAME=ID></td> > <td><TMPL_VAR NAME=NAME></td> > <td><TMPL_VAR NAME=PRICE></td> > </tr> > </TMPL_LOOP> > > If I wanted to do say: > > <TMPL_LOOP ROWS> > <tr bgcolor="#<TMPL_IF ODD>666666<TMPL_ELSE>EEEEEE</TMPL_IF>"> > <td><TMPL_VAR NAME=ID></td> > <TMPL_LOOP INNERROWS> > <TMPL_VAR NAME=SUBID> > </TMPL_LOOP> > <td><TMPL_VAR NAME=NAME></td> > <td><TMPL_VAR NAME=PRICE></td> > </tr> > </TMPL_LOOP> > > > For the life of me, I can't figure out how to do it... > > I have repeatedly destroyed my own code, so I will use the perlmonks > code.. > > This is what I have been trying, is it even *close* to right??? > > while ($sth->fetch) { > my $real_price = $price < $saleprice ? $price : $saleprice; > $name =~ s/\b(\w)(\w+)\b/\U$1\L$2/g; > push @rows, { ID => lc($id), PRICE => $real_price, NAME => $name, > +ODD => $i++ %2 }; > $sum += $real_price; > while ($sth2->fetch) { > push @innerrows, { SUBID => $sub_id }; > } > } > > $sth->finish; > $sth2->finish; > > my $t = HTML::Template->new(filename => 'db2.tmpl', @tmpl_opts); > $t->param(ROWS => \@rows, INNERROWS => \@innerrows); > > I know this isn't my code, but like I said, iv destroyed mine over and > over.. But this gives you the idea of what iv been trying, each time with > failure. > > Any help is very much appreciated as I am very frustrated :) > > Thx! > -c > > > > -----Original Message----- > > From: htm...@li... > > [mailto:htm...@li...]On Behalf Of > > Kenneth Gonsalves > > Sent: Sunday, November 16, 2003 2:38 AM > > To: Chris; htm...@li... > > Subject: Re: [htmltmpl] MySQL -> HTML::Template > > > > > > On Sunday 16 November 2003 12:17, Chris wrote: > > > Hey all, > > > > > > Im new to HTML:Template, and it looks pretty nice, but I > > have not seen > > > anything related to using MySQL output. Basically all I really > > want to do > > > is be able to give my web designers tags like: %%SEARCH_RESULTS%% > which > > > when the page is parsed by my cgi using HTML:Template will > > recieve my sql > > > results. Is anybody doing this? > > > > > > Any pointers very much appreciated:) > > > -c > > there is a very nice tutorial on this in perlmonks.org > > -- > > regards > > kg > > > > http://www.ootygolfclub.org > > > > > > ------------------------------------------------------- > > This SF. Net email is sponsored by: GoToMyPC > > GoToMyPC is the fast, easy and secure way to access your computer from > > any Web browser or wireless device. Click here to Try it Free! > > https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl > > _______________________________________________ > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Chris <chr...@co...> - 2003-11-17 18:29:15
|
Thanks for the link, it helped me very much! Now once again im stuck... How do I do nested loops?? Using the perlmonks example: <TMPL_LOOP ROWS> <tr bgcolor="#<TMPL_IF ODD>666666<TMPL_ELSE>EEEEEE</TMPL_IF>"> <td><TMPL_VAR NAME=ID></td> <td><TMPL_VAR NAME=NAME></td> <td><TMPL_VAR NAME=PRICE></td> </tr> </TMPL_LOOP> If I wanted to do say: <TMPL_LOOP ROWS> <tr bgcolor="#<TMPL_IF ODD>666666<TMPL_ELSE>EEEEEE</TMPL_IF>"> <td><TMPL_VAR NAME=ID></td> <TMPL_LOOP INNERROWS> <TMPL_VAR NAME=SUBID> </TMPL_LOOP> <td><TMPL_VAR NAME=NAME></td> <td><TMPL_VAR NAME=PRICE></td> </tr> </TMPL_LOOP> For the life of me, I can't figure out how to do it... I have repeatedly destroyed my own code, so I will use the perlmonks code.. This is what I have been trying, is it even *close* to right??? while ($sth->fetch) { my $real_price = $price < $saleprice ? $price : $saleprice; $name =~ s/\b(\w)(\w+)\b/\U$1\L$2/g; push @rows, { ID => lc($id), PRICE => $real_price, NAME => $name, +ODD => $i++ %2 }; $sum += $real_price; while ($sth2->fetch) { push @innerrows, { SUBID => $sub_id }; } } $sth->finish; $sth2->finish; my $t = HTML::Template->new(filename => 'db2.tmpl', @tmpl_opts); $t->param(ROWS => \@rows, INNERROWS => \@innerrows); I know this isn't my code, but like I said, iv destroyed mine over and over.. But this gives you the idea of what iv been trying, each time with failure. Any help is very much appreciated as I am very frustrated :) Thx! -c > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of > Kenneth Gonsalves > Sent: Sunday, November 16, 2003 2:38 AM > To: Chris; htm...@li... > Subject: Re: [htmltmpl] MySQL -> HTML::Template > > > On Sunday 16 November 2003 12:17, Chris wrote: > > Hey all, > > > > Im new to HTML:Template, and it looks pretty nice, but I > have not seen > > anything related to using MySQL output. Basically all I really > want to do > > is be able to give my web designers tags like: %%SEARCH_RESULTS%% which > > when the page is parsed by my cgi using HTML:Template will > recieve my sql > > results. Is anybody doing this? > > > > Any pointers very much appreciated:) > > -c > there is a very nice tutorial on this in perlmonks.org > -- > regards > kg > > http://www.ootygolfclub.org > > > ------------------------------------------------------- > This SF. Net email is sponsored by: GoToMyPC > GoToMyPC is the fast, easy and secure way to access your computer from > any Web browser or wireless device. Click here to Try it Free! > https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Kenneth G. <la...@th...> - 2003-11-16 07:15:59
|
On Sunday 16 November 2003 12:17, Chris wrote: > Hey all, > > Im new to HTML:Template, and it looks pretty nice, but I have not seen > anything related to using MySQL output. Basically all I really want to do > is be able to give my web designers tags like: %%SEARCH_RESULTS%% which > when the page is parsed by my cgi using HTML:Template will recieve my sql > results. Is anybody doing this? > > Any pointers very much appreciated:) > -c there is a very nice tutorial on this in perlmonks.org -- regards kg http://www.ootygolfclub.org |
From: Chris <chr...@co...> - 2003-11-16 06:49:56
|
Hey all, Im new to HTML:Template, and it looks pretty nice, but I have not seen anything related to using MySQL output. Basically all I really want to do is be able to give my web designers tags like: %%SEARCH_RESULTS%% which when the page is parsed by my cgi using HTML:Template will recieve my sql results. Is anybody doing this? Any pointers very much appreciated:) -c |
From: Puneet K. <pk...@ei...> - 2003-11-15 14:20:55
|
On Nov 15, 2003, at 8:06 AM, Nishikant Kapoor wrote: > Hello list, > > How can I display the retrieved results at predefined spots in the > output template, using a tmpl_loop? > Here is the exact problem: > > I retrieve 8 members from db, create a tmpl_loop and display them in > the template in 4 rows. But, I want these members to be at certain > spots: > > Member-2 Member-5 > Member-7 Member-1 > Member-3 Member-6 > Member-4 Member-8 > > two ways come to mind -- 1. judicious use of tmpl_if and ::expr OR 2. the tmpl_loop is nothing but a ref to an array of hashes. Array elements can be arrranged any way you want, and the arrangment will persist (unlike a hash, which has its own mind about these things). Just arrange your results from the db in the way you want before stuffing them in the array... when you unfold the array you will get what you want. |
From: Nishikant K. <nk...@we...> - 2003-11-15 14:02:35
|
Hello list, How can I display the retrieved results at predefined spots in the output template, using a tmpl_loop? Here is the exact problem: I retrieve 8 members from db, create a tmpl_loop and display them in the template in 4 rows. But, I want these members to be at certain spots: Member-2 Member-5 Member-7 Member-1 Member-3 Member-6 Member-4 Member-8 Can it be done? Thanks, Nishi |
From: Karen J. C. <si...@ph...> - 2003-11-06 04:33:06
|
On Thu, 6 Nov 2003, Mathew Robertson wrote: MR>So my question is, "Has this bug been solved, and/or anyone got a solution to this?" I ran across this a few weeks ago, and posted it here. No patches yet (that I've noticed, anyway), but I figured out a workaround. The variables exist in the inner loop if they're *used* in the outer loop. So if you put them inside a comment in the outer loop, you're more or less okay. -- Karen J. Cravens si...@ph... |
From: Mathew R. <mat...@re...> - 2003-11-06 04:06:23
|
Hi all, Firstly, I am new to the H::T list, but I have been using H::T for well = over a year now. I am having a problem with TMPL_VAR's not existing in nested loops. eg: <TMPL_LOOP loop1> <TMPL_LOOP loop2> <TMPL_VAR var1_loop1> </TMPL_LOOP> </TMPL_LOOP> where 'var1_loop1' is a template var from the first loop. Things to note: - I have global_vars enabled - I have loop_context_vars enable (even though this is irrelevant). - I am using H::T 2.6 and H::T::E 0.4 (ie the latest) I have searched through the archives (and read most of the archive going = back at least 12 months), and found that others have also had this = problem. I know how to work around the problem - simply reference the TMPL_VAR in = the outer loop using a <TMPL_IF var1_loop1></TMPL_IF>, but seems like a = kludge. So my question is, "Has this bug been solved, and/or anyone got a = solution to this?" regards, Mathew Mathew Robertson Senior Technical Support Engineer [mat...@re...]=20 96-98 Market Street +61 3 8606 4041 = tel South Melbourne, Vic 3205 +61 3 8606 4001 fax www.redsheriff.com.au=20 This message and any files transmitted with it are confidential and = intended solely for the use of the individual or entity to whom they are = addressed. If you are not the intended recipient, you are hereby = notified that any use or dissemination of this communication is strictly = prohibited. If you have received this message in error please notify us = immediately by return email or telephone +1 (212) 905-6115, then delete = this message. Any views expressed in this message are those of the = individual sender and may not necessarily reflect the views of = RedSheriff. |
From: Neil <htm...@ia...> - 2003-11-03 23:03:22
|
Hello Possibly the worlds second smallest patch... In html::template::expr the character '.' should IMO be part of variables. I use this to use things like 'dc.title'. --- template/Expr.pm.orig 2003-11-03 22:56:55.000000000 +0000 +++ template/Expr.pm 2003-11-03 22:57:33.000000000 +0000 @@ -46,7 +46,7 @@ args : <leftop: subexpression ',' subexpression> -var : /[A-Za-z_][A-Za-z0-9_]*/ { \\\$item[1] } +var : /[A-Za-z_][A-Za-z0-9_\.]*/ { \\\$item[1] } literal : /-?\\d*\\.\\d+/ { \$item[1] } | /-?\\d+/ { \$item[1] } |
From: l.f.elia <l.f...@la...> - 2003-11-03 21:47:53
|
Ok, guys (and ladies) don't laugh too loudly -- it apparently helps to spell tags correctly :-) Thank you all... Lee |
From: Karen J. C. <si...@ph...> - 2003-11-03 21:13:06
|
On Tue, 4 Nov 2003, Cees Hek wrote: CH>Without showing us the code and the template you are using it is difficult to CH>figure out where the error actually is. But I can explain what that error CH>message is telling you. Actually, he said he was using the example code, which does in fact have a variable called "path" (actually, "PATH"): http://search.cpan.org/~samtregar/HTML-Template-2.6/Template.pm If it's not puking until it gets to the $template->param(PATH => $ENV{PATH}); statement, and the template really does have My Path is set to <TMPL_VAR NAME=PATH> in it, I'm somewhat puzzled. My guess would have to be that one of the two instances (presumeably the template, if the error was accurately quoted) has a typo somewhere. -- Karen J. Cravens si...@ph... |
From: Ben A. <Ben...@na...> - 2003-11-03 20:36:20
|
>=20 > I get this error: >=20 > HTML::Template : Attempt to set nonexistent parameter 'path'=20 > - this parameter name doesn't match any declarations in the=20 > template file : (die_on_bad_params =3D> 1) at templ.pl line 6 >=20 > please help... It's die'ing because die_on_bad_params is set, and you're passing a param which doesn't have a corresponding tag in the template. You can switch this behaviour off: my $template =3D HTML::Template->new(filename =3D> = 'your_template.tmpl', die_on_bad_params =3D> 0); Kind regards, Ben |
From: Cees H. <ce...@si...> - 2003-11-03 20:25:27
|
Quoting "l.f.elia" <l.f...@la...>: > Hello All, > I've been checking out HTML::Template, ($HTML::Template::VERSION = > '2.6';), and I cannot get it to work with the examples in the > documentation. > > I am using activestate perl ActivePerl Build 633 on win32, nothing > fancy just the examples, but they wont work. Is this a windows problem? > > I get this error: > > HTML::Template : Attempt to set nonexistent parameter 'path' - this > parameter name doesn't match any declarations in the template file : > (die_on_bad_params => 1) at templ.pl line 6 Without showing us the code and the template you are using it is difficult to figure out where the error actually is. But I can explain what that error message is telling you. You have asked HTML::Template to fill in a value in the template called 'path'. But there is no coresponding value in the template called 'path', hence it is complaining. You need to add a <TMPL_VAR NAME="path"> in your template file somewhere. Or you need to remove the path parameter from your code (you must have a call to $template->param(path => 'some value') in your code somewhere that is adding the 'path' parameter to the template). I hope that gets you on track. If not, return here and post the code you have and we will go from there. Cheers, Cees > > please help... > -- > There are at least two kinds of games. One could be called finite, the > other infinite. A finite game is played for the purpose of winning, an > infinite game for the purpose of continuing the play. -- James Carse > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |