html-template-users Mailing List for HTML::Template (Page 11)
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: Blesson P. <ble...@ya...> - 2007-06-15 16:30:44
|
Just add to that, If I didn't do Template->param, there is no issue. That means there is no issue in reading or writing back. Thanks Blesson Paul --- Blesson Paul <ble...@ya...> wrote: > Hi, > > I have an issue with apache and HTML template. When > HTML::Tempate->param process files, it add extra > charecters in between UTF charecters. It won't > happen > if I execute from command line. > > I belive there is some thing in the apache env which > causes this issue. In most of the time, control-C > charecter is added. > > > Did anybody faced the same issue. > > Thanks > Blesson Paul > > > > ____________________________________________________________________________________Ready > for the edge of your seat? > Check out tonight's top picks on Yahoo! TV. > http://tv.yahoo.com/ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 > express and take > control of your XML. No limits. Just data. Click to > get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > ____________________________________________________________________________________ Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 |
From: Blesson P. <ble...@ya...> - 2007-06-15 16:28:35
|
Hi, I have an issue with apache and HTML template. When HTML::Tempate->param process files, it add extra charecters in between UTF charecters. It won't happen if I execute from command line. I belive there is some thing in the apache env which causes this issue. In most of the time, control-C charecter is added. Did anybody faced the same issue. Thanks Blesson Paul ____________________________________________________________________________________Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. http://tv.yahoo.com/ |
From: Mathew R. <mat...@ne...> - 2007-06-15 02:38:10
|
Hi List, [ Eventually I will post a patch to H::T to a webpage, in the meantime I have sent an update version directly to Joshua. If others are interested in this patch, shoot me a email. ] > I am happy to say that I haven't run into any problems using Mathew's > patch. It's exactly what I wanted/needed! Thanks! > Thats good. > I do have a feature request though: > > Currently if I leave out 2 params, it only notifies me that one of > them is missing. It would be nice if I was told when both were > missing. > Hadn't considered that. The existing coding practice within H::T is that is croak's immediately on error conditions. However, in the case of this option, adding support for accumulating the errors is pretty trivial, so I did. > This issue applies to die_on_bad_params as well, but it's slightly > more subtle, because the dying point is different. With > die_on_bad_params, you die as soon as the param is set, so no list of > bad_params could accumulate. (unless of course you wait until > $template->output() to die). > > Also, I've noticed that if I comment out a <tmpl_var ...> in the > template file, die_on_missing_params still thinks I should set it. > Likewise, if I set a parameter that has been commented out, > die_on_bad_params remains silent. Perhaps this is the intended > behavior... after all, somebody may want to fill in html comments from > the code. And adding a new comment syntax to template files would > detract from it's great simplicity. Besides, commenting out code is > considered bad practice anyway, isn't it? :) > Some browsers support conditional compilation/execution, which means that HTML comments are actually parsed. In fact, since HTML comments are true-dinks DOM elements, there are some javascript libraries that parse the comment block to enable extra features, while being old-browser compatible. So yes, you want TMPL_xxx parsed inside HTML comments. If you really want to comment out a TMPL_VAR, you could try unsetting "strict" so that you can do: <TMPL_VAR name> => <TMPL_ZUH name> Or if you need to comment out a HTML block, you can use a H::T filter such as: sub tmpl_comment { my $filter = sub { my $text_ref = shift; my $match = qr/<(?:\!--\s*)?[Tt][Mm][Pp][Ll]_[Cc][Oo][Mm][Mm][Ee][Nn][Tt]\s*(?:--)?>.*?<(?:\!--\s*)?\/[Tt][Mm][Pp][Ll]_[Cc][Oo][Mm][Mm][Ee][Nn][Tt]\s*(?:--)?>/s; $$text_ref =~ s/$match//g; }; return $filter; } $ht = HTML::Template->new(...., filter => tmpl_comment,...); <TMPL_COMMENT> ... some <a...> html </a> </TMPL_COMMENT> Regards, Mathew Robertson |
From: Joshua B. <sci...@gm...> - 2007-06-14 14:27:38
|
Hi list, I am happy to say that I haven't run into any problems using Mathew's patch. It's exactly what I wanted/needed! Thanks! I do have a feature request though: Currently if I leave out 2 params, it only notifies me that one of them is missing. It would be nice if I was told when both were missing. This issue applies to die_on_bad_params as well, but it's slightly more subtle, because the dying point is different. With die_on_bad_params, you die as soon as the param is set, so no list of bad_params could accumulate. (unless of course you wait until $template->output() to die). Also, I've noticed that if I comment out a <tmpl_var ...> in the template file, die_on_missing_params still thinks I should set it. Likewise, if I set a parameter that has been commented out, die_on_bad_params remains silent. Perhaps this is the intended behavior... after all, somebody may want to fill in html comments from the code. And adding a new comment syntax to template files would detract from it's great simplicity. Besides, commenting out code is considered bad practice anyway, isn't it? :) Again, thanks for the patch! Josh "Ua" Ball On 5/31/07, Mathew Robertson <mat...@ne...> wrote: > > Hi List, > > Patch sent directly to Josh so as to avoid the list noise. If people are > interested, I will post it (and the test cases). > > cheers, > Mathew > > > > Joshua Ball wrote: > Hi Mathew, > > (This is the same Josh as @highgatecross. My e-mail there is down, so > I subscribed from another address. :->) > > That's exactly what I'm looking for. I'm dealing with legacy code > which has highly nested includes in the templates. From what I've been > able to tell, I don't think the original coder relied on implicit > undefness. My main concern is that I want to be warned if there are > subs that I ought to be calling (to fill in template parameters in > things like headers and footers). It's especially easy to overlook > when the tmpl_var's are used for "hidden" information, like URLs and > hidden form fields. > > Where can I find your patch? > > Thanks again, > Josh "Ua" Ball > > On 5/31/07, Mathew Robertson > <mat...@ne...> wrote: > > > Short answer: no there isn't such a feature. > > However I do have a patch I use to add this ability - with one caveat... > the patch changes the behaviour such that if your code never implemented: > > $ht->param(parm_name => undef); > > but did rely on the undef'ness of param_name, then your code would need the > above line added where appropriate. I found that I would often write: > > $ht->param(param_name => get_something()); > > so param_name would be explicitely set to undef, and so the patch works for > me. > > Mathew Robertson > > > > > Joshua wrote: > Greetings. > > (I'm sorry if I double posted this. However, the first time I sent it, I was > not subscribed to the mailing list, so I don't think it went through.) > > I find the "die_on_bad_params => 1" to be a very useful feature. Setting it > to 0 is kind of like debugging Perl without "use strict;". > > However, die_on_bad_params only does half the job. It dies if I try to set > non-existent vars, but it does nothing if I forget to set an existing var. > Is there a way (such as a die_on_missing_params option) that I can turn on > some such warning system? (Perhaps there are some extensions to > HTML::Template that do this?) > > Any help is appreciated. > > Josh "Ua" Ball > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > |
From: Joshua B. <sci...@gm...> - 2007-06-01 14:00:36
|
Thanks! I'll start using it and let you know if I run into any problems. On 5/31/07, Mathew Robertson <mat...@ne...> wrote: > > Hi List, > > Patch sent directly to Josh so as to avoid the list noise. If people are > interested, I will post it (and the test cases). > > cheers, > Mathew > > > > Joshua Ball wrote: > Hi Mathew, > > (This is the same Josh as @highgatecross. My e-mail there is down, so > I subscribed from another address. :->) > > That's exactly what I'm looking for. I'm dealing with legacy code > which has highly nested includes in the templates. From what I've been > able to tell, I don't think the original coder relied on implicit > undefness. My main concern is that I want to be warned if there are > subs that I ought to be calling (to fill in template parameters in > things like headers and footers). It's especially easy to overlook > when the tmpl_var's are used for "hidden" information, like URLs and > hidden form fields. > > Where can I find your patch? > > Thanks again, > Josh "Ua" Ball > > On 5/31/07, Mathew Robertson > <mat...@ne...> wrote: > > > Short answer: no there isn't such a feature. > > However I do have a patch I use to add this ability - with one caveat... > the patch changes the behaviour such that if your code never implemented: > > $ht->param(parm_name => undef); > > but did rely on the undef'ness of param_name, then your code would need the > above line added where appropriate. I found that I would often write: > > $ht->param(param_name => get_something()); > > so param_name would be explicitely set to undef, and so the patch works for > me. > > Mathew Robertson > > > > > Joshua wrote: > Greetings. > > (I'm sorry if I double posted this. However, the first time I sent it, I was > not subscribed to the mailing list, so I don't think it went through.) > > I find the "die_on_bad_params => 1" to be a very useful feature. Setting it > to 0 is kind of like debugging Perl without "use strict;". > > However, die_on_bad_params only does half the job. It dies if I try to set > non-existent vars, but it does nothing if I forget to set an existing var. > Is there a way (such as a die_on_missing_params option) that I can turn on > some such warning system? (Perhaps there are some extensions to > HTML::Template that do this?) > > Any help is appreciated. > > Josh "Ua" Ball > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > |
From: Barry C. <ba...@rj...> - 2007-06-01 12:56:41
|
Actually, Mathew, I'd be interested in that, too. Rather than posting the patch and tests to the list, do you happen to have a webpage that you can upload it to? That way, you can just post a link to it. > ------------------------------ > > Message: 4 > Date: Fri, 01 Jun 2007 09:11:58 +1000 > From: Mathew Robertson <mat...@ne...> > Subject: Re: [htmltmpl] die_on_missing_params > Cc: htm...@li... > Message-ID: <465...@ne...> > Content-Type: text/plain; charset="iso-8859-1" > > Hi List, > > Patch sent directly to Josh so as to avoid the list noise. If people > are interested, I will post it (and the test cases). > > cheers, > Mathew > > > |
From: Marcin G. <mg...@fo...> - 2007-06-01 11:55:49
|
On Friday of June 1 2007, you wrote: > Did you ever resolve this? After looking at the problem again, I > suspect that some variable was being set/used incorrectly, ie: a scalar > was being set on the param, but trying to be used in a loop -> or more > specifically vice versa inside an EXPR... Unfortunately - no, the only way to solve it is to turn off cache, I use following options: my %default_options = ( die_on_bad_params => 0, search_path_on_include => 1, loop_context_vars => 1, global_vars => 1, strict => 1, cache => 1, ); after I set cache=>0 the errors don't show anymore (with cache on they show randomly, like once every 10-20 calls - with the same almost static (just several includes) page)... Any help or directions how to debug this will be appreciated. greetings -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |
From: Robert H. <si...@gm...> - 2007-06-01 11:45:55
|
Joshua wrote: > Greetings. > > (I'm sorry if I double posted this. However, the first time I sent it, I was > not subscribed to the mailing list, so I don't think it went through.) > > I find the "die_on_bad_params => 1" to be a very useful feature. Setting it > to 0 is kind of like debugging Perl without "use strict;". > > However, die_on_bad_params only does half the job. It dies if I try to set > non-existent vars, but it does nothing if I forget to set an existing var. > Is there a way (such as a die_on_missing_params option) that I can turn on > some such warning system? (Perhaps there are some extensions to > HTML::Template that do this?) > > Any help is appreciated. > Maybe something as simple as a patch to allow: die_on_unset_vars => 1 Robert |
From: Mathew R. <mat...@ne...> - 2007-05-31 23:11:33
|
Hi List, Patch sent directly to Josh so as to avoid the list noise. If people are interested, I will post it (and the test cases). cheers, Mathew Joshua Ball wrote: > Hi Mathew, > > (This is the same Josh as @highgatecross. My e-mail there is down, so > I subscribed from another address. :->) > > That's exactly what I'm looking for. I'm dealing with legacy code > which has highly nested includes in the templates. From what I've been > able to tell, I don't think the original coder relied on implicit > undefness. My main concern is that I want to be warned if there are > subs that I ought to be calling (to fill in template parameters in > things like headers and footers). It's especially easy to overlook > when the tmpl_var's are used for "hidden" information, like URLs and > hidden form fields. > > Where can I find your patch? > > Thanks again, > Josh "Ua" Ball > > On 5/31/07, Mathew Robertson <mat...@ne...> wrote: > >> Short answer: no there isn't such a feature. >> >> However I do have a patch I use to add this ability - with one caveat... >> the patch changes the behaviour such that if your code never implemented: >> >> $ht->param(parm_name => undef); >> >> but did rely on the undef'ness of param_name, then your code would need the >> above line added where appropriate. I found that I would often write: >> >> $ht->param(param_name => get_something()); >> >> so param_name would be explicitely set to undef, and so the patch works for >> me. >> >> Mathew Robertson >> >> >> >> >> Joshua wrote: >> Greetings. >> >> (I'm sorry if I double posted this. However, the first time I sent it, I was >> not subscribed to the mailing list, so I don't think it went through.) >> >> I find the "die_on_bad_params => 1" to be a very useful feature. Setting it >> to 0 is kind of like debugging Perl without "use strict;". >> >> However, die_on_bad_params only does half the job. It dies if I try to set >> non-existent vars, but it does nothing if I forget to set an existing var. >> Is there a way (such as a die_on_missing_params option) that I can turn on >> some such warning system? (Perhaps there are some extensions to >> HTML::Template that do this?) >> >> Any help is appreciated. >> >> Josh "Ua" Ball >> >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users >> >> >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Joshua B. <sci...@gm...> - 2007-05-31 14:25:27
|
Hi Mathew, (This is the same Josh as @highgatecross. My e-mail there is down, so I subscribed from another address. :->) That's exactly what I'm looking for. I'm dealing with legacy code which has highly nested includes in the templates. From what I've been able to tell, I don't think the original coder relied on implicit undefness. My main concern is that I want to be warned if there are subs that I ought to be calling (to fill in template parameters in things like headers and footers). It's especially easy to overlook when the tmpl_var's are used for "hidden" information, like URLs and hidden form fields. Where can I find your patch? Thanks again, Josh "Ua" Ball On 5/31/07, Mathew Robertson <mat...@ne...> wrote: > > Short answer: no there isn't such a feature. > > However I do have a patch I use to add this ability - with one caveat... > the patch changes the behaviour such that if your code never implemented: > > $ht->param(parm_name => undef); > > but did rely on the undef'ness of param_name, then your code would need the > above line added where appropriate. I found that I would often write: > > $ht->param(param_name => get_something()); > > so param_name would be explicitely set to undef, and so the patch works for > me. > > Mathew Robertson > > > > > Joshua wrote: > Greetings. > > (I'm sorry if I double posted this. However, the first time I sent it, I was > not subscribed to the mailing list, so I don't think it went through.) > > I find the "die_on_bad_params => 1" to be a very useful feature. Setting it > to 0 is kind of like debugging Perl without "use strict;". > > However, die_on_bad_params only does half the job. It dies if I try to set > non-existent vars, but it does nothing if I forget to set an existing var. > Is there a way (such as a die_on_missing_params option) that I can turn on > some such warning system? (Perhaps there are some extensions to > HTML::Template that do this?) > > Any help is appreciated. > > Josh "Ua" Ball > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > |
From: Mathew R. <mat...@ne...> - 2007-05-31 07:08:49
|
Short answer: no there isn't such a feature. However I do have a patch I use to add this ability - with one caveat... the patch changes the behaviour such that if your code never implemented: $ht->param(parm_name => undef); but did rely on the undef'ness of param_name, then your code would need the above line added where appropriate. I found that I would often write: $ht->param(param_name => get_something()); so param_name would be explicitely set to undef, and so the patch works for me. Mathew Robertson Joshua wrote: > Greetings. > > (I'm sorry if I double posted this. However, the first time I sent it, I was > not subscribed to the mailing list, so I don't think it went through.) > > I find the "die_on_bad_params => 1" to be a very useful feature. Setting it > to 0 is kind of like debugging Perl without "use strict;". > > However, die_on_bad_params only does half the job. It dies if I try to set > non-existent vars, but it does nothing if I forget to set an existing var. > Is there a way (such as a die_on_missing_params option) that I can turn on > some such warning system? (Perhaps there are some extensions to > HTML::Template that do this?) > > Any help is appreciated. > > Josh "Ua" Ball > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Joshua <jo...@hi...> - 2007-05-30 20:47:58
|
Greetings. (I'm sorry if I double posted this. However, the first time I sent it, I was not subscribed to the mailing list, so I don't think it went through.) I find the "die_on_bad_params => 1" to be a very useful feature. Setting it to 0 is kind of like debugging Perl without "use strict;". However, die_on_bad_params only does half the job. It dies if I try to set non-existent vars, but it does nothing if I forget to set an existing var. Is there a way (such as a die_on_missing_params option) that I can turn on some such warning system? (Perhaps there are some extensions to HTML::Template that do this?) Any help is appreciated. Josh "Ua" Ball |
From: Mathew R. <mat...@ne...> - 2007-05-03 23:36:20
|
Having never actually tried this, I'm only about 99% sure that it will work as "expected", which is -> the in child loop you will see the child's counter - not the parent's counter. Technically: the __counter__ is setup for each loop context -> the "global_vars" thing which causes parent vars to be resolved inside the loop, is resolved later in the output() phase and not in the parse() phase which is where the __counter__ is set. Your example is using a PARENT_LOOP_COUNTER - is that the name of the variable, or was that meant to represent that you need access to the parent's __counter__? If it is a real variable, then your template should work as expected, provided you use the "global_vars" option (as well as "loop_context_vars"). If PARENT_LOOP_COUNTER was just a way of explaining that you need access to the parent's __counter__, then you are out of luck -> you will have to find another way to do what you need. Hope this helps, Mathew Michael Greenish wrote: > Thanks, Mathew, for the response. That looks easy enough. Now, what > if I have two nested tmpl_loops and I want to only apply the break tag > on the first set of nested template loop date? > > For example: > > <tmpl_loop albums> > > <tmpl_loop pictures> > ... > <img src="<tmpl_var src>" alt="" /> > <tmpl_if expr="(__counter__ % 3) == 0 && PARENT_LOOP_COUNTER < > 1"><br /></tmpl_if> > > </tmpl_loop> > </tmpl_loop> > > Can I "see" the counter for the parent loop inside the child loop? > > Thanks. > > greanie > > ----- Original Message ---- > From: Mathew Robertson <mat...@ne...> > To: Michael Greenish <gr...@ya...> > Cc: htm...@li... > Sent: Monday, April 30, 2007 7:31:07 PM > Subject: Re: [htmltmpl] loop counting > > sure thing - but it does require using H::T::Expr. I use the > following snippet as-is to a gallery of photo's. Notice the use of > modulo (%). > > Mathew > > <table width=100% border=0 cellpadding=1 cellspacing=1> > <TMPL_LOOP gallery> > <TMPL_IF EXPR="(__counter__ % 3) == 1"> > <tr valign=top> > </TMPL_IF> > <td width=33% align=center valign=top class=text> > <a href="<TMPL_VAR paths.gallery>/<TMPL_VAR NAME=filename ESCAPE=URL>" title="Click to enlarge"><img alt="" src="<TMPL_VAR paths.thumbnail>/<TMPL_VAR NAME=filename ESCAPE=URL>" width=180 height=200 border=0></a><br> > <<TMPL_VAR spacer> width=10 height=6><br> > <TMPL_VAR NAME=description ESCAPE=TEXT> > </td> > <TMPL_IF EXPR="(__counter__ % 3) == 0"> > </tr> > > <tr> > <td colspan=3> > <<TMPL_VAR spacer> height=18 width=100%> > </td> > </tr> > </TMPL_IF> > </TMPL_LOOP> > </table> > > > > > Michael Greenish wrote: >> Hello, >> >> I have a series of images that I would like to output but I want to limit it to only 4 images per row. I would like to put a br tag to force the 5th, 9th, etc... image to go to the next row. Can I do this completely int the template using an iterator or resettable counter? >> >> Thanks, >> >> greanie >> >> >> >> __________________________________________________ >> Do You Yahoo!? >> Tired of spam? Yahoo! Mail has the best spam protection around >> http://mail.yahoo.com >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users >> > > > ------------------------------------------------------------------------ > Ahhh...imagining that irresistible "new car" smell? > Check out new cars at Yahoo! Autos. > <http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-> > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Michael G. <gr...@ya...> - 2007-05-03 18:18:44
|
Thanks, Mathew, for the response. That looks easy enough. Now, what if I have two nested tmpl_loops and I want to only apply the break tag on the first set of nested template loop date? For example: <tmpl_loop albums> <tmpl_loop pictures> ... <img src="<tmpl_var src>" alt="" /> <tmpl_if expr="(__counter__ % 3) == 0 && PARENT_LOOP_COUNTER < 1"><br /></tmpl_if> </tmpl_loop> </tmpl_loop> Can I "see" the counter for the parent loop inside the child loop? Thanks. greanie ----- Original Message ---- From: Mathew Robertson <mat...@ne...> To: Michael Greenish <gr...@ya...> Cc: htm...@li... Sent: Monday, April 30, 2007 7:31:07 PM Subject: Re: [htmltmpl] loop counting sure thing - but it does require using H::T::Expr. I use the following snippet as-is to a gallery of photo's. Notice the use of modulo (%). Mathew <table width=100% border=0 cellpadding=1 cellspacing=1> <TMPL_LOOP gallery> <TMPL_IF EXPR="(__counter__ % 3) == 1"> <tr valign=top> </TMPL_IF> <td width=33% align=center valign=top class=text> <a href="<TMPL_VAR paths.gallery>/<TMPL_VAR NAME=filename ESCAPE=URL>" title="Click to enlarge"><img alt="" src="<TMPL_VAR paths.thumbnail>/<TMPL_VAR NAME=filename ESCAPE=URL>" width=180 height=200 border=0></a><br> <<TMPL_VAR spacer> width=10 height=6><br> <TMPL_VAR NAME=description ESCAPE=TEXT> </td> <TMPL_IF EXPR="(__counter__ % 3) == 0"> </tr> <tr> <td colspan=3> <<TMPL_VAR spacer> height=18 width=100%> </td> </tr> </TMPL_IF> </TMPL_LOOP> </table> Michael Greenish wrote: Hello, I have a series of images that I would like to output but I want to limit it to only 4 images per row. I would like to put a br tag to force the 5th, 9th, etc... image to go to the next row. Can I do this completely int the template using an iterator or resettable counter? Thanks, greanie __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Marcin G. <mg...@fo...> - 2007-05-03 09:28:19
|
On Thursday of May 3 2007, Mathew Robertson wrote: > Are you using a filter by any chance? If so, you could try temporarily > disabling it and/or could you post a code snippet if its use. Sorry, no filters. I dumped $parse_stack and it's like this (parts of html skipped - (...)), but it's all messy, not sure if you can get anything from this... STACK:$VAR1 = [ \'<html> (...) <link rel="stylesheet" href="/others/all.css"> ', bless( [ bless( do{\(my $o = undef)}, 'HTML::Template::VAR' ), 0, 0, '3', 0 ], 'HTML::Template::COND' ), \' <link rel="stylesheet" href="/others/ajax.css"> <script src="/others/ajax_kl.js"></script> ', bless( do{\(my $o = undef)}, 'HTML::Template::NOOP' ), \' <link rel="shortcut icon" href="/favicon.ico" > (...) <br> ', bless( [ bless( do{\(my $o = '1')}, 'HTML::Template::VAR' ), 0, 0, '7', 0 ], 'HTML::Template::COND' ), \' <a href= (...) </a> ', $VAR1->[3], \'<br> on-line: <b>' ]; -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |
From: Mathew R. <mat...@ne...> - 2007-05-03 01:35:50
|
Hi Marcin, Are you using a filter by any chance? If so, you could try temporarily disabling it and/or could you post a code snippet if its use. Mathew Marcin Gryszkalis wrote: > One in every few calls to my application ends with error desctribed below. > I'm not sure when it started or what stared these errors. > It doesn't depend on template, number of calls or something else, seems > pretty random. > Important: turning off cache seems to heal it. > > H::T version 2.9 > H::T::Expr version 0.07 > > Not an ARRAY reference > at /usr/local/lib/perl5/site_perl/5.8.8/HTML/Template/Expr.pm line 238. > > > Expr.pm snippet: > > sub output { > my $self = shift; > my $parse_stack = $self->{parse_stack}; > my $options = $self->{options}; > my ($expr, $expr_func); > > # pull expr and expr_func out of the parse_stack for cache mode. > if ($options->{cache}) { > $expr = pop @$parse_stack; > $expr_func = pop @$parse_stack; > } else { > $expr = $options->{expr}; > $expr_func = $options->{expr_func}; > } > > # setup expression evaluators > my %param; > for (my $x = 0; $x < @$expr; $x++) { # <---- l. 238 is HERE ----------- > my $node = $expr->[$x]; > $param{"__expr_" . $x . "__"} = sub { _expr_evaluate($node, @_) }; > } > $self->param(\%param); > > > > I dumped variables before the loop and got this > > about $expr: > > type = SCALAR > value = SCALAR(0xfc7a2a0) > value2 = "<br> > on-line: <b>" > > > I can provide more info but not sure what's important. > best regards > |
From: Karen <kar...@gm...> - 2007-05-02 17:21:24
|
On 5/2/07, Alicia Amadoz <Ali...@uv...> wrote: > I have read something about environment variables HTML_TEMPLATE_ROOT > and HTML_TEMPLATE_PATH but I am very confused with how they should be > defined. Could anyone help me to solve this error? You can set the environment variables within Perl like so: $ENV{'HTML_TEMPLATE_ROOT'} = '/whatever/your/template/path/is'; You can also pass it from the environment (hence the name) but that introduces some taint issues. The "new" statement has a "path" option as well, which will be checked after the environment variable. And you can explicitly put the fully specified filename in the "new" statement (by starting it with "/") - useful for debugging, but of course if you do this everywhere and want to change it later, it defeats the purpose of the path variables. |
From: Alicia Amadoz<Ali...@uv...> - 2007-05-02 16:46:45
|
Hi, I'm new to HTML::Template and I have installed version 2.8-2 on fedora 5 with yumex. I have tried the example of the webpage at 'synopsis' section (with test.tmpl) and I have an error: [error] HTML::Template->new() : Cannot open included file test.tmpl : file not found. at /usr/lib/perl5/vendor_perl/5.8.8/HTML/Template.pm line 1632\n\tHTML::Template::_init_template('HTML::Template=3DHASH(0x97495f4)') called at /usr/lib/perl5/vendor_perl/5.8.8/HTML/Template.pm line 1205\ (...= ) I have read something about environment variables HTML_TEMPLATE_ROOT and HTML_TEMPLATE_PATH but I am very confused with how they should be defined. Could anyone help me to solve this error? Thank you in advance. Regards, Alicia |
From: Marcin G. <mg...@fo...> - 2007-05-02 12:44:46
|
One in every few calls to my application ends with error desctribed below. I'm not sure when it started or what stared these errors. It doesn't depend on template, number of calls or something else, seems pretty random. Important: turning off cache seems to heal it. H::T version 2.9 H::T::Expr version 0.07 Not an ARRAY reference at /usr/local/lib/perl5/site_perl/5.8.8/HTML/Template/Expr.pm line 238. Expr.pm snippet: sub output { my $self = shift; my $parse_stack = $self->{parse_stack}; my $options = $self->{options}; my ($expr, $expr_func); # pull expr and expr_func out of the parse_stack for cache mode. if ($options->{cache}) { $expr = pop @$parse_stack; $expr_func = pop @$parse_stack; } else { $expr = $options->{expr}; $expr_func = $options->{expr_func}; } # setup expression evaluators my %param; for (my $x = 0; $x < @$expr; $x++) { # <---- l. 238 is HERE ----------- my $node = $expr->[$x]; $param{"__expr_" . $x . "__"} = sub { _expr_evaluate($node, @_) }; } $self->param(\%param); I dumped variables before the loop and got this about $expr: type = SCALAR value = SCALAR(0xfc7a2a0) value2 = "<br> on-line: <b>" I can provide more info but not sure what's important. best regards -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |
From: Sven N. <sve...@sv...> - 2007-05-02 08:54:49
|
Dan Horne wrote: > Is there a way to loop from a lower integer to an higher one? For example, > say an article has a rating of 4. I'd like to loop from 1 to 4 and print a > star at each iteration. The only way I can see of doing this is create an > array ref in the perl coder and pass that to the template, which seems a lot > of pointless effort In this particular case I'd suggest you create 6 graphics (with 1-6 stars) and use something like <img src="stars<TMPL_VAR NAME="stars">.gif" alt="<TMPL_VAR NAME="stars"> stars"> -Sven |
From: Mathew R. <mat...@ne...> - 2007-04-30 23:51:28
|
sure thing - but it does require using H::T::Expr. I use the following snippet as-is to a gallery of photo's. Notice the use of modulo (%). Mathew <table width=100% border=0 cellpadding=1 cellspacing=1> <TMPL_LOOP gallery> <TMPL_IF EXPR="(__counter__ % 3) == 1"> <tr valign=top> </TMPL_IF> <td width=33% align=center valign=top class=text> <a href="<TMPL_VAR paths.gallery>/<TMPL_VAR NAME=filename ESCAPE=URL>" title="Click to enlarge"><img alt="" src="<TMPL_VAR paths.thumbnail>/<TMPL_VAR NAME=filename ESCAPE=URL>" width=180 height=200 border=0></a><br> <<TMPL_VAR spacer> width=10 height=6><br> <TMPL_VAR NAME=description ESCAPE=TEXT> </td> <TMPL_IF EXPR="(__counter__ % 3) == 0"> </tr> <tr> <td colspan=3> <<TMPL_VAR spacer> height=18 width=100%> </td> </tr> </TMPL_IF> </TMPL_LOOP> </table> Michael Greenish wrote: > Hello, > > I have a series of images that I would like to output but I want to limit it to only 4 images per row. I would like to put a br tag to force the 5th, 9th, etc... image to go to the next row. Can I do this completely int the template using an iterator or resettable counter? > > Thanks, > > greanie > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Michael G. <gr...@ya...> - 2007-04-30 18:07:18
|
Hello, I have a series of images that I would like to output but I want to limit it to only 4 images per row. I would like to put a br tag to force the 5th, 9th, etc... image to go to the next row. Can I do this completely int the template using an iterator or resettable counter? Thanks, greanie __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Arkadiy <ar...@ar...> - 2007-04-30 13:10:40
|
Everybody else displays 5 stars, plus "refuse rating" and "Not Interested" options, and highlight current "popular" ratings and allow user to rank, in half increments. On 4/29/07, Alex Teslik <al...@ac...> wrote: > my $ratingloop = [ map { {RATING => $_} } (1..$ratingmax) ]; > > or something like that (untested). > > The effort seems pointless until the flexibility is used by the template > designer to do something special at each rating... or something else no one > has thought of yet. I'd go with the loop. TMPL_FOR puts logic in the template, > which is what HT is all about preventing. > > 2c > > > On Mon, 30 Apr 2007 12:11:08 +1200, Dan Horne wrote > > Hi all > > > > Is there a way to loop from a lower integer to an higher one? For > > example, say an article has a rating of 4. I'd like to loop from 1 > > to 4 and print a star at each iteration. The only way I can see of > > doing this is create an array ref in the perl coder and pass that to > > the template, which seems a lot of pointless effort > > > > Regards > > > > Dan > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Alex T. <al...@ac...> - 2007-04-30 06:44:10
|
my $ratingloop = [ map { {RATING => $_} } (1..$ratingmax) ]; or something like that (untested). The effort seems pointless until the flexibility is used by the template designer to do something special at each rating... or something else no one has thought of yet. I'd go with the loop. TMPL_FOR puts logic in the template, which is what HT is all about preventing. 2c On Mon, 30 Apr 2007 12:11:08 +1200, Dan Horne wrote > Hi all > > Is there a way to loop from a lower integer to an higher one? For > example, say an article has a rating of 4. I'd like to loop from 1 > to 4 and print a star at each iteration. The only way I can see of > doing this is create an array ref in the perl coder and pass that to > the template, which seems a lot of pointless effort > > Regards > > Dan > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Mathew R. <mat...@ne...> - 2007-04-30 02:41:10
|
>> If you just want to print 4 stars, then just do that. * * * * >> >> If you are looking for some indentation background, you could try >> something like the following on a div: >> >> style="background:url('star.gif') right repeat-y;" >> >> If you are looking for something like <TMPL_FOR 1..4> then you >> probably need to re-evaluate why you need it - maybe you need to re- >> think your original problem. That said, there have been previous >> discussions on whether the TMPL_xxx syntax should support user-defined >> extensions, and various people have their own hacks to allow such a >> feature (which would then allow you to build your TMPL_FOR). >> > > Well my problem is that sometimes I want to iterate through a numeric > range. If an article is ranked 4 stars then the designer can either > iterate through each ranking and display a star or he/she can simply > output "4 stars." (one customer likes the latter, another wants the > former). This is a pretty good example where we could consider H::T to be lacking. This type of UI choice is definitely something that is unrelated to business logic, and very much related to UI design - so one could argue that choice it should be implemented in the templates. In this case, I would argue for a case where H::T could be extended so that a TMPL_FOR could be used. [ In fact, had I have came across this same problem, since I use my modified version of H::T, I could have implemented a TMPL_FOR or something similar. ] > Likewise, I use Data::Page::Navigation for paginated data - > it's a really nice module, and if it displays 10 indexes at the bottom > of the page, say from 5 - 14, it would be nice if I could iterate > through them rather than doing it in Perl. It's not a religious > decision, it just gives the flexibility to the designers. > I haven't used Data::Page et al. but have previously created my own code to do similar. AFAICT, are you suggesting using D::P / D::P::N to do something like: my $dp = new D::P(...); $ht->param(pages_in_navigation => $dp->pages_in_navigation(...)); ? Then you would need to do some "prorgamming" in your template to get the values into something printable - which may be not in the spirit of H::T. When I created my pager, I emitted template variables into a global hash which eventually got set into the H::T->param() using a template variable "prefix" so that I could use multiple paginations in a single H::T output. Looking at D::P's API it would appear that some shim code needs to do something similar (ie: something like a H::T::DP ) with an API that looks a bit like: $ht = new H::T(..) $dp = new D::P(...); ... H::T::DP->publish( $ht, $dp, prefix => "pager_"); ... $ht->output(); >> What is the problem you are trying to solve? Someone here might have >> solved it already... >> > > I hope this gives enough info. If I'm doing it wrong, I'm only too > pleased to be told if there's a better way. Michael Peters suggested > Javascript as one solution, although I'd prefer a solution in H::T if > possible. I have looked through the docs, and couldn't see anything > obvious, but was hoping that perhaps someone had solved this problem > before me via some kind of logic that I hadn't thought of. > One problem with a javascript solution is that it makes localisation more complex - still do-able, but easier on the server side as your javascript would have to be aware of whether "4 stars" and "stars 4" is the correct ordering (ie: where "stars 4" would be the in some other langauge where the number comes after the description). [ There are already some Perl modules capable of this type of localisation complexity - implementing it Javascript would be possible, but I'm not sure if it would be worthwhile. ] Mathew |