html-template-users Mailing List for HTML::Template (Page 28)
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: Mark S. <ma...@su...> - 2005-10-14 14:43:32
|
Hello, I'm curious about what other people think about an option to turn ESCAPE=HTML on default, to protect against cross script scripting practices by default. This seems especially valuable when the convenient "associate => $q" option is used. Then programmers would be forcing themselves to consciously add "NOESCAPE=html" to a tag. To me, this seems like the equivalent of turning "use strict" on by default, and explicitly declaring "no strict" where needed. Thoughts? Mark |
From: Dan H. <dan...@re...> - 2005-10-13 03:25:32
|
> From: Rhesa Rozendaal: > Unfortunately, it's almost 4:30 am here, and I really need to > get some sleep. Sleep! Sleep! You crazy Perl hackers with your bizarre hours! |
From: Rhesa R. <rh...@cp...> - 2005-10-13 02:28:44
|
Hi Dan, Dan Horne wrote: > Hi all, > > First off, apologies if this is not the correct place to discuss > HTML::Template::Plugin::Dot - if there is an alternative, please let me > know. Strictly speaking, this list is specifically for HTML::Template, and the related modules authored by Sam Tregar. I don't know if he minds us discussing HTP::Dot here, but I do have the sneaking suspicion he doesn't really appreciate my little module: it goes against the main philosophy of HTML::Template. In any case I take full responsibility for it myself: Sam is in no way involved in the dot extension. I'll put a more prominent note in my docs about where to get support for it. > I came across a problem when I tried using CGI::Application::Plugin::HTDot - > I couldn't use a parameter with a dot in its name as per the > HTML::Template::Plugin::Dot examples. Instead I get: > > Bare word 't.name' not allowed in argument list to 'greeting' in dot > expression 't.greeting(t.name)' at > /usr/local/lib/perl5/site_perl/5.8.0/Class/Trigger.pm line 51 Ok, now that the disclaimer is out of the way, let's have a look at your issue. Subexpressions are still rather limited and fragile, and depend heavily on what you pass in, and in which order. In this case, I'm assuming that the problem is related to the fact that you're referencing the same object in two levels. If you dare, take a quick look at my HTML::Template::Plugin::Dot::Helpers package. It has some working examples of dotted subexpressions. Unfortunately, it's almost 4:30 am here, and I really need to get some sleep. Your test script is a great help in driving the point home, and will give me a good headstart in debugging. I'll get back to you tomorrow, hopefully. > I wondering if I misunderstand the ability to supply dotted parameters to > method calls. I've come up with a simple case that illustrates my problem > below No, I think your example ought to work. I appreciate the test code! > Regards > > Dan > Rhesa Rozendaal <rh...@cp...> |
From: Dan H. <dan...@re...> - 2005-10-13 01:08:52
|
Hi all, First off, apologies if this is not the correct place to discuss HTML::Template::Plugin::Dot - if there is an alternative, please let me know. I came across a problem when I tried using = CGI::Application::Plugin::HTDot - I couldn't use a parameter with a dot in its name as per the HTML::Template::Plugin::Dot examples. Instead I get: Bare word 't.name' not allowed in argument list to 'greeting' in dot expression 't.greeting(t.name)' at /usr/local/lib/perl5/site_perl/5.8.0/Class/Trigger.pm line 51 I wondering if I misunderstand the ability to supply dotted parameters = to method calls. I've come up with a simple case that illustrates my = problem below Regards Dan --code-- package Test; use strict; sub name { my $self =3D shift; $self->{name} ||=3D shift; return $self->{name}; } sub greeting { my $self =3D shift; my $name =3D shift; return "hello $name"; } sub new { my $class =3D shift; bless {}, $class; } 1; use HTML::Template::Pluggable; use HTML::Template::Plugin::Dot; my $text =3D '<tmpl_var t.greeting(t.name)>'; my $test =3D Test->new(); $test->name('bob'); my $template =3D HTML::Template::Pluggable->new(scalarref =3D> \$text); $template->param('t' =3D> $test); print $template->output; |
From: Sam T. <sa...@tr...> - 2005-10-11 18:40:29
|
On Mon, 10 Oct 2005, Octavian Rasnita wrote: > I have noticed that the module HTML::Template::Compiled stores the vars in > memory when using mod_perl, and possibly displays them for the next visitor. HTML::Template::Compiled is not generally supported on this list. I don't mind if people talk about it here but I thought you should know that it's not necessarily the right place for bug reports. -sam |
From: Octavian R. <ora...@fc...> - 2005-10-10 19:55:27
|
Hi, I have noticed that the module HTML::Template::Compiled stores the vars in memory when using mod_perl, and possibly displays them for the next visitor. I have created the following test mod_perl handler using the template below it. Note: If I just change HTML::Template::Compiled with HTML::Template, the program works fine, with no errors. Am I doing something wrong? The program: package Presa::User; use strict; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(:common); use CGI qw(:standard); use HTML::Template::Compiled (); sub handler { my $r = shift; my $q = CGI->new($r); if ($q->param('sent')) { #The form was sent my $foo = $q->param('foo'); my $bar = $q->param('bar'); my %vars = ( title => 'Sample title 2', foo => $foo, bar => $bar, ); my $ht = HTML::Template::Compiled->new( path => 'e:/web/presaromana/templates', filename => 'to_delete.html', ); $ht->param(%vars); $r->content_type('text/html'); $r->headers_out(); $r->print($ht->output()); undef $ht; return Apache2::Const::OK; } else { #The form was not sent. Print just the form my $ht = HTML::Template::Compiled->new( path => 'e:/web/presaromana/templates', filename => 'to_delete.html', ); $ht->param(title => 'Sample title 1'); $r->content_type('text/html'); $r->headers_out(); $r->print($ht->output()); undef $ht; return Apache2::Const::OK; } #end sub handler } 1; The template: <html> <head><title><TMPL_VAR name=title></title></head> <body> <TMPL_IF name=foo>Foo: <TMPL_VAR name=foo></TMPL_IF> <br /> <TMPL_IF name=bar>bar: <TMPL_VAR name=bar></TMPL_IF> <br /> <form action="/user" method="post"> <input type="hidden" name="sent" value="1" /> Foo: <input type="text" name="foo" value="<TMPL_IF name=foo><TMPL_VAR name=foo></TMPL_IF>" /><br /> bar: <input type="text" name="bar" value="<TMPL_IF name=bar><TMPL_VAR name=bar></TMPL_IF>" /><br /> <input type="submit"> </form> </body> </html> Teddy |
From: Peter L. <pe...@pe...> - 2005-09-29 13:06:24
|
Michael, I would too. :) --peter On Thu, 29 Sep 2005 mic...@cs... wrote: > Hello Rajesh, Hello Peter, > > thanks for your help. > > Will use Rajesh one's, cause it looks easier for me. > > Regards > Michael > > "Rajesh_K" <Raj...@Sa...> schrieb am 29.09.2005 13:14:16: > >> I am doing this quite successfully with the following code: >> >> In the HTML template >> >> <TMPL_INCLUDE NAME="%mainbody%"> >> >> In the perl script >> >> my $filter = \&tmpl_filter; >> my $template = HTML::Template->new(filename => 'insider_tmpl.html', >> path=> $self->param('tmpl_path'), filter=>$filter); >> >> sub tmpl_filter() >> { >> my $text_ref = shift; >> $$text_ref =~ s/%mainbody%/$body_include/g; >> }; >> >> Regards, >> Rajesh >> >> -----Original Message----- >> From: htm...@li... >> [mailto:htm...@li...] On Behalf Of >> Peter Leonard >> Sent: Wednesday, September 28, 2005 7:48 PM >> To: mic...@cs... >> Cc: htm...@li... >> Subject: Re: [htmltmpl] is it possible to use var in include >> >> >> Michael, >> >> In my experience, the only way to make that work is by making two passes >> >> through HTML::Template, creating a custom filter on the first pass. >> >> So your template syntax would look like this: >> >> [TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>] >> >> The first pass would set the 'mod' param, but ignore the outer tags. >> The >> second pass would use a filter to convert all the [TMPL] tags to >> standard >> <TMPL> tags, and then behave as normal. >> >> Something like the following perl-pseudo: >> >> $tmpl->param(mod=>'include.tmpl'); >> my $pass = $tmpl->output(); >> >> my $tmpl2 = HTML::Template->new(scalarref => $pass, >> filter => >> sub { $_ =~ s/\[(TMPL[^\]]+)\]/<$1>/gis; }); >> >> $tmpl2->param(%other_vars); >> >> return $tmpl2->output(); >> >> >> HTH, >> >> --pete >> >> >> On Wed, 28 Sep 2005 mic...@cs... wrote: >> >>> Hello all, >>> >>> Is that not possible? <TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>> >>> Cause depending in which mode I open the template I want to show up a >>> differnt body (e.g. start page, register page, search page...) >>> >>> Regards >>> Michael >> >> ---- >> Peter Leonard >> pe...@pe... >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: >> Power Architecture Resource Center: Free content, downloads, >> discussions, >> and more. http://solutions.newsforge.com/ibmarch.tmpl >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users >> >> >> >> DISCLAIMER: >> This email (including any attachments) is intended for the sole use >> of the intended recipient/s and may contain material that is >> CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance >> by others or copying or distribution or forwarding of any or all of >> the contents in this message is STRICTLY PROHIBITED. If you are not >> the intended recipient, please contact the sender by email and >> delete all copies; your cooperation in this regard is appreciated. >> > ---- Peter Leonard pe...@pe... |
From: <mic...@cs...> - 2005-09-29 12:21:32
|
Hello Rajesh, Hello Peter, thanks for your help. Will use Rajesh one's, cause it looks easier for me. Regards Michael "Rajesh_K" <Raj...@Sa...> schrieb am 29.09.2005 13:14:16: > I am doing this quite successfully with the following code: > > In the HTML template > > <TMPL_INCLUDE NAME="%mainbody%"> > > In the perl script > > my $filter = \&tmpl_filter; > my $template = HTML::Template->new(filename => 'insider_tmpl.html', > path=> $self->param('tmpl_path'), filter=>$filter); > > sub tmpl_filter() > { > my $text_ref = shift; > $$text_ref =~ s/%mainbody%/$body_include/g; > }; > > Regards, > Rajesh > > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...] On Behalf Of > Peter Leonard > Sent: Wednesday, September 28, 2005 7:48 PM > To: mic...@cs... > Cc: htm...@li... > Subject: Re: [htmltmpl] is it possible to use var in include > > > Michael, > > In my experience, the only way to make that work is by making two passes > > through HTML::Template, creating a custom filter on the first pass. > > So your template syntax would look like this: > > [TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>] > > The first pass would set the 'mod' param, but ignore the outer tags. > The > second pass would use a filter to convert all the [TMPL] tags to > standard > <TMPL> tags, and then behave as normal. > > Something like the following perl-pseudo: > > $tmpl->param(mod=>'include.tmpl'); > my $pass = $tmpl->output(); > > my $tmpl2 = HTML::Template->new(scalarref => $pass, > filter => > sub { $_ =~ s/\[(TMPL[^\]]+)\]/<$1>/gis; }); > > $tmpl2->param(%other_vars); > > return $tmpl2->output(); > > > HTH, > > --pete > > > On Wed, 28 Sep 2005 mic...@cs... wrote: > > > Hello all, > > > > Is that not possible? <TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>> > > Cause depending in which mode I open the template I want to show up a > > differnt body (e.g. start page, register page, search page...) > > > > Regards > > Michael > > ---- > Peter Leonard > pe...@pe... > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, > discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > DISCLAIMER: > This email (including any attachments) is intended for the sole use > of the intended recipient/s and may contain material that is > CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance > by others or copying or distribution or forwarding of any or all of > the contents in this message is STRICTLY PROHIBITED. If you are not > the intended recipient, please contact the sender by email and > delete all copies; your cooperation in this regard is appreciated. > |
From: Rajesh_K <Raj...@Sa...> - 2005-09-29 11:40:47
|
I am doing this quite successfully with the following code: In the HTML template <TMPL_INCLUDE NAME=3D"%mainbody%"> In the perl script my $filter =3D \&tmpl_filter; my $template =3D HTML::Template->new(filename =3D> 'insider_tmpl.html', path=3D> $self->param('tmpl_path'), filter=3D>$filter); sub tmpl_filter()=20 { my $text_ref =3D shift; $$text_ref =3D~ s/%mainbody%/$body_include/g; }; Regards, Rajesh -----Original Message----- From: htm...@li... [mailto:htm...@li...] On Behalf Of Peter Leonard Sent: Wednesday, September 28, 2005 7:48 PM To: mic...@cs... Cc: htm...@li... Subject: Re: [htmltmpl] is it possible to use var in include Michael, In my experience, the only way to make that work is by making two passes through HTML::Template, creating a custom filter on the first pass. So your template syntax would look like this: [TMPL_INCLUDE NAME=3D<TMPL_VAR NAME=3Dmod>] The first pass would set the 'mod' param, but ignore the outer tags. The=20 second pass would use a filter to convert all the [TMPL] tags to standard=20 <TMPL> tags, and then behave as normal. Something like the following perl-pseudo: $tmpl->param(mod=3D>'include.tmpl'); my $pass =3D $tmpl->output(); my $tmpl2 =3D HTML::Template->new(scalarref =3D> $pass, filter =3D> sub { $_ =3D~ s/\[(TMPL[^\]]+)\]/<$1>/gis; }); $tmpl2->param(%other_vars); return $tmpl2->output(); HTH, --pete On Wed, 28 Sep 2005 mic...@cs... wrote: > Hello all, > > Is that not possible? <TMPL_INCLUDE NAME=3D<TMPL_VAR NAME=3Dmod>> > Cause depending in which mode I open the template I want to show up a > differnt body (e.g. start page, register page, search page...) > > Regards > Michael ---- Peter Leonard pe...@pe... ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users DISCLAIMER: This email (including any attachments) is intended for the sole use of = the intended recipient/s and may contain material that is CONFIDENTIAL = AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or = copying or distribution or forwarding of any or all of the contents in = this message is STRICTLY PROHIBITED. If you are not the intended = recipient, please contact the sender by email and delete all copies; = your cooperation in this regard is appreciated. |
From: Mitar <mm...@gm...> - 2005-09-28 18:36:54
|
Hi! > This gets me the results I was looking for but feel that it is very much = a > kludge. Have I missed something in the docs like a param for the > constructor that automagicly does the same thing I have done minus me hav= ing > to do anything? Having seen the results of an HTML::Template minus the > blank lines makes me want to see such results all the time without modify= ing > my code and templates to do so. I use this filter: our $line_merger =3D sub { =09my $text_ref =3D shift; =09# Removes HTML comment style format from the tags (so that next regex wo= rks) =09$$text_ref =3D~ s/<!--\s*(~?\/?TMPL_.+?)\s*-->/<$1>/gis; =09# "Cleans" tags in such a way that it removes the space characters and ~ (so if there is no ~ it does not =09# remove anything) =09$$text_ref =3D~ s/(?:\n[ \t]*(?=3D<~))?<~?(\/?TMPL_[^>~]+)~?(\/?)>(?:(?:(?<=3D~\/>)|(?<=3D~>))[ \t]*\n)?/<$1$2>/gis; }; The idea is that I can use ~ character to specify that I want newline remov= ed. For example: <~TMPL_VAR NAME=3D"foo"~> will remove newline before and after the tag (if there is any). In most cases I use only second ~ as this efficiently (in most template uses) removes all newlines after the tags and so there are no empty lines in the output. Mitar |
From: Peter L. <pe...@pe...> - 2005-09-28 14:21:26
|
Michael, In my experience, the only way to make that work is by making two passes through HTML::Template, creating a custom filter on the first pass. So your template syntax would look like this: [TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>] The first pass would set the 'mod' param, but ignore the outer tags. The second pass would use a filter to convert all the [TMPL] tags to standard <TMPL> tags, and then behave as normal. Something like the following perl-pseudo: $tmpl->param(mod=>'include.tmpl'); my $pass = $tmpl->output(); my $tmpl2 = HTML::Template->new(scalarref => $pass, filter => sub { $_ =~ s/\[(TMPL[^\]]+)\]/<$1>/gis; }); $tmpl2->param(%other_vars); return $tmpl2->output(); HTH, --pete On Wed, 28 Sep 2005 mic...@cs... wrote: > Hello all, > > Is that not possible? <TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>> > Cause depending in which mode I open the template I want to show up a > differnt body (e.g. start page, register page, search page...) > > Regards > Michael ---- Peter Leonard pe...@pe... |
From: <mic...@cs...> - 2005-09-28 14:11:25
|
Hello all, Is that not possible? <TMPL_INCLUDE NAME=<TMPL_VAR NAME=mod>> Cause depending in which mode I open the template I want to show up a differnt body (e.g. start page, register page, search page...) Regards Michael |
From: Clifton R. <cli...@ti...> - 2005-09-27 20:05:31
|
On Tue, Sep 27, 2005 at 03:23:14PM -0400, David Steinbrunner wrote: > Hello, > > I would first like to say I'm a long time user, first time poster... > > I have always used HTML::Template to generate web pages in the past but have > recently started work on a project that creates a config file and I decided > to use HTML::Template to help separated the hard coded config info from my > code. This has worked out great in all but one regard. > > All the non TMPL_VAR tags end up leaving blank lines behind because I leave > them on their own lines for the sake of being able to read the tmpl file > easily. This how ever makes it hard to read the generated config file > because of all the extra white space. I had similar problems when I was trying to use it to generate a text-only version of an email along with an HTML-version of the same email. > I have always felt this was an issue but did not care enough to post about > it because the results were "just" HTML source and the like. I can deal > with reading spaced out HTML source but this config is going to be read by > others that will need to be able to read and understand it quickly. This can also cause problems even in HTML, when (for example) there are conditional expressions with the result of the expression embedded in a variable value. As I recall there is a kludge where you can work around it with some very odd formatting of the original template - place the trailing newline *inside* the intermediate and end tags, e.g : "<TMPL_IF foo>bar< TMPL_ELSE>baz< /TMPL_IF >" results in "bar" or "baz" rather than having embedded newlines. ... > This gets me the results I was looking for but feel that it is very much a > kludge. Have I missed something in the docs like a param for the > constructor that automagicly does the same thing I have done minus me having > to do anything? Having seen the results of an HTML::Template minus the > blank lines makes me want to see such results all the time without modifying > my code and templates to do so. FWIW, I'm not very actively working with HTML::Template right now, but if I were I would definitely want to use such a feature. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect "My own personal theory is that this is the very dawn of the world. We're hardly more than an eyeblink away from the fall of Troy, and scarcely an interglaciation removed from the Altamira cave painters. We live in extremely interesting ancient times. I like this idea. It encourages us to be earnest and ingenious and brave, as befits ancestral peoples; but keeps us from deciding that because we don't know all the answers, they must be unknowable and thus unprofitable to pursue." -- Teresa Nielsen Hayden, 1995 |
From: David S. <ca...@po...> - 2005-09-27 19:23:20
|
Hello, I would first like to say I'm a long time user, first time poster... I have always used HTML::Template to generate web pages in the past but have recently started work on a project that creates a config file and I decided to use HTML::Template to help separated the hard coded config info from my code. This has worked out great in all but one regard. All the non TMPL_VAR tags end up leaving blank lines behind because I leave them on their own lines for the sake of being able to read the tmpl file easily. This how ever makes it hard to read the generated config file because of all the extra white space. I have always felt this was an issue but did not care enough to post about it because the results were "just" HTML source and the like. I can deal with reading spaced out HTML source but this config is going to be read by others that will need to be able to read and understand it quickly. While looking over the documentation I found the ability to filter the tmpl before it is written out and created the following code for the following contrived sample: my $filter = sub { my $text_ref = shift; $$text_ref =~ s/\n\| *//g; }; my $tmpl = HTML::Template->new( filename => $template, filter => $filter ); |<tmpl_if name="stuff"> | <tmpl_loop name="stuff"> This <tmpl_var name="key"> has that <tmpl_var name="value"> | </tmpl_loop> |<tmpl_else> # Nothing to see here |</tmpl_if> This gets me the results I was looking for but feel that it is very much a kludge. Have I missed something in the docs like a param for the constructor that automagicly does the same thing I have done minus me having to do anything? Having seen the results of an HTML::Template minus the blank lines makes me want to see such results all the time without modifying my code and templates to do so. Thanks, -- David Steinbrunner |
From: Johan K. <ku...@re...> - 2005-09-27 18:52:21
|
I think you mixed up the 'header' concept. The meta tags go in the HTML header. The cookies go in the HTTP header, which is different from the HTML header, and out of the scope of HTML::Template. I use CGI::Application as my framework. I made a small tutorial using CGI::Application and HTML::Template which may help you: http://redantigua.com/cookies.html Regards, Johan Kuuse On Tuesday 27 September 2005 12:12, Chris Beck wrote: > Hey all, > > I am used to using CGI to set cookies and other header objects, but I am > finding that my HTML Template templates are complete HTML documents. What > is the standard HTML Template way of doing this? I could define a template > var for various meta tags and content types, &c, but how do people do > cookies? > > Cheers, > Chris > -- > Chris Beck - http://pacanukeha.blogspot.com > The other day, in the park, I was wondering why frisbees look bigger and > bigger as they get closer to you. And then it hit me. > -- http://bash.org/?479067 > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users -- Johan Kuuse ku...@re... Tue Sep 27 12:44:25 2005 |
From: Chris B. <htm...@pa...> - 2005-09-27 18:13:25
|
Hey all, I am used to using CGI to set cookies and other header objects, but I am finding that my HTML Template templates are complete HTML documents. What is the standard HTML Template way of doing this? I could define a template var for various meta tags and content types, &c, but how do people do cookies? Cheers, Chris -- Chris Beck - http://pacanukeha.blogspot.com The other day, in the park, I was wondering why frisbees look bigger and bigger as they get closer to you. And then it hit me. -- http://bash.org/?479067 |
From: Sam T. <sa...@tr...> - 2005-09-14 21:03:10
|
On Wed, 14 Sep 2005, David Kaufman wrote: > Has anyone tried this XS implementation of HTML::Template? > http://search.cpan.org/~viy/HTML-Template-Pro-0.50/ I'm interested > to hear whether it is really "10-25 times faster" than pure-perl > HTML::Template and/or really 1-3 times faster than H::T with caching > under mod_perl... I did try it. I found two problems: 1) it's slower than HTML::Template::JIT and 2) it has some significant compatibility problems. An example of 2, if I remember correctly, is that errors are communicated by embedding the error message in the return value from output() rather than via die(). -sam |
From: Justin S. <ju...@sk...> - 2005-09-14 20:57:34
|
Dada Mail 2.10 has been released. I'll save the bandwidth and not list all the new whiz-bang features, if you'd like, here's some market-talk: http://mojo.skazat.com/features/2_10/ One thing I wanted to focus on was its use of HTML::Template for it's HTML screens. The last major release, I moved over all the inline HTML over to HTML::Template. One of my hopes was that since this HTML was now more easily accessible, that it would spur interest in a wider audience of hackers that have different skillsets than Perl. Well, it seemed to pay off, and I had another developer join my team that who is an absolute gearhead in XHTML/css take over rewriting/ maintaining the HTML screens. There's now about 80 separate HTML::Template templates and we've been able to validate and make them absolutely XHTML/css savvy. He tells me that what you see at: http://csszengarden.com/ Is now possible with Dada Mail. Neat. So, kudos to the HTML::Template development team and H::T hackers. Moving the HTML out of the Perl code was one of the best things that could have been done for the program. I'm pondering on writing an article on what needed to be done to move from the mishmash in the Perlcode, to the current system. I think I've been pondering this for a while. One day :) -- Justin Simoni .: Dada Mail "Write Once - Distribute Everywhere" Email Communication Software url: http://dadamail.org ph: 720.436.7701 aolim: leaddadaist |
From: David K. <da...@gi...> - 2005-09-14 17:33:58
|
Has anyone tried this XS implementation of HTML::Template? http://search.cpan.org/~viy/HTML-Template-Pro-0.50/ I'm interested to hear whether it is really "10-25 times faster" than pure-perl HTML::Template and/or really 1-3 times faster than H::T with caching under mod_perl... -dave |
From: Clifton R. <cli...@ti...> - 2005-09-06 20:09:25
|
On Mon, Sep 05, 2005 at 10:28:34AM -0700, Arka Roy wrote: ... > > As far as I can tell, you seem to be doing things > just fine. Does the > > error > > show up without SSL? Does it show up in non-IE > browsers? You do not, > > perchance, have any load-balancers in the equation > do you? They can > > sometimes > > screw up SSL sessions. > > The error does NOT show up if I do not use SSL. Also, > it does NOT show up in Firefox, with or without SSL. > I also gave it a spin on Opera using SSL and it worked > fine. So just the combination of SSL on IE, so far. I missed the original problem description, but I ran into one very like what you describe last year. This was with a template->post->redirect->template->post->redirect sequence. It turned out that in a redirect or post action URL which was constructed via HTML::Template variable substitution, a line feed was getting into the variable value fed in on the second page's template, and thus into the URL used when you posted from there. That broke IE and Safari, but worked with FireFox/Netscape/Mozilla. If this is the problem, viewing HTML source when at the second template page will show it up. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect "My own personal theory is that this is the very dawn of the world. We're hardly more than an eyeblink away from the fall of Troy, and scarcely an interglaciation removed from the Altamira cave painters. We live in extremely interesting ancient times. I like this idea. It encourages us to be earnest and ingenious and brave, as befits ancestral peoples; but keeps us from deciding that because we don't know all the answers, they must be unknowable and thus unprofitable to pursue." -- Teresa Nielsen Hayden, 1995 |
From: Carl F. <fir...@gm...> - 2005-09-05 18:56:46
|
Well, it was more of a mental list, but here's what I asked of my last host before going with them. Does the size of the mysql database count towards the normal diskspace allowance? If not, is there a max size for the database? Is spam-assassin installed/supported? fastCGI? Is it possible to upload my site / setup email addresses before the domainname transfered? Also, there would have been other questions in my mind that were already answered by looking at the hosts' website, such as SSH access to error_log and access_log access to disk space outside of the public_html folder installed c compiler sufficient diskspace space to build my own perl if necessary suExec CGI - so that scripts run under my username - means I can set my database password file to only readable by me virtual SSL - e.g. https://mydomain.myhost.com - does this hit my own public_html and cgi-bin folders, rather than having to duplicate all the files on another machine. real POP3 boxes - also, are the usernames (before the @) shared with all the other domains on the server (sorry, 'sales' user already exists!) is bandwidth incoming + outgoing, or the larger of the 2 mysql version Of course, one must comprimise sometimes! I think a bigger issue for the less-experienced is the quality of technical support. A mailing list you can join, or a forum you can read, to see how they deal with things before signing up is invaluable. Also, regarding the Original Poster's issue, I think what I would have to do is, figure out whether this (IE bug) was fixed in a particular apache release, and make sure the host is running that. Carl |
From: Bodo S. <bo...@le...> - 2005-09-05 18:22:59
|
Hey Carl, > Myself, I have a big list of things to ask before moving to a new > host. I'll be adding this to the list, in case I ever have to move > again. Do you have this list handy? It could be useful to others. In any case, it would be useful to me. Regards, -bodo |
From: Carl F. <fir...@gm...> - 2005-09-05 18:14:59
|
Arka, Going back through the murky mists of my memories, several years ago to my first encouter with CGI, I came across a IE - apache specific problem. It was a perl CGI running on apache with SSL. Occasionally, but not every time, there was an error message which only occured with IE. I didn't know anything about CGI / perl at the time, I googled some and found a reference to incompatibilities between IE and apache. However, in the last few years of CGI work, I've never come across the problem again. So, I've just had a quick google, and come across a description of the problem - with solution - here http://www.extremetech.com/article2/0,3973,20373,00.asp Unfortunately, the fix described requires the server admin to make a configuration change. As an example, here is the header which is sent to the browser, when you look at a page on my site: HTTP/1.1 200 OK Date: Mon, 05 Sep 2005 18:05:47 GMT Server: Apache/1.3.31 (Unix) mod_fastcgi/2.4.2 PHP/4.1.2 PHP/3.0.17 mod_perl/1.21 mod_ssl/2.8.19 OpenSSL/0.9.6l Set-Cookie: fig_CGISESSID=3Dba338462f251a165c9192f7cb6595f07; path=3D/; expires=3DThu, 31-Aug-2006 18:05:47 GMT Connection: close Content-Type: text/html; charset=3Dutf-8 Now, only the last line there is actually printed by my CGI, everything before it is sent by apache, and out of the control of my CGI program. I said _unfortunately_, because your hosts might not want to make that change. If you ask them, do send the link above, to explain your problem to them. And if they're not helpful, I can recommend a very good host :) Myself, I have a big list of things to ask before moving to a new host. I'll be adding this to the list, in case I ever have to move again. Hope this helps, Carl |
From: Arka R. <ark...@ya...> - 2005-09-05 17:28:46
|
Chris, Thank you kindly for your response. > HTTP is a somewhat stateless protocol, so in general the > post->template->post > round trip is perfectly safe. It is actually post->template->post->template Not sure if that makes a difference though. Also it is not clear to me how it being a stateless protocol implies that the round trip is OK. I am a newbie though, so don't worry about explaining the whole background unless it can be reduced to a one-liner. :-) > As far as I can tell, you seem to be doing things just fine. Does the > error > show up without SSL? Does it show up in non-IE browsers? You do not, > perchance, have any load-balancers in the equation do you? They can > sometimes > screw up SSL sessions. The error does NOT show up if I do not use SSL. Also, it does NOT show up in Firefox, with or without SSL. I also gave it a spin on Opera using SSL and it worked fine. So just the combination of SSL on IE, so far. What are load-balancers? I just mailed the hosting company asking if they use load-balancers just so I can get a yes or no, which I will mail here later. > error? Does anything show up in the server logs? This is bizzare, but the hosting company says on their support page that they no longer provide error logs. I will call them tomorrow and ask about it. > Is there any more detail in the error message > than "The > Page Cannot Be Displayed"? Is it an IE error or IE reporting a > server-side error? The error message is the pretty familiar IE "The page cannot be displayed" error page. Right-clicking the page and checking the properties, the URL is as follows: res://C:\WINDOWS\system32\shdoclc.dll/dnserror.htm#https://ssl.somedomain.com/forms/Scripts/SubmitData.cgi The title in IE's title bar is Cannot find server. I am not sure if this is an IE error or IE reporting a server-side error. It is a very normal-looking IE error page, that most people are probably familiar with but never read in detail (myself included!). Here is the entire message on the page, bounded by the lines of asterisks. ******************* The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. -------------------------------------------------------------------------------- Please try the following: Click the Refresh button, or try again later. If you typed the page address in the Address bar, make sure that it is spelled correctly. To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP). See if your Internet connection settings are being detected. You can set Microsoft Windows to examine your network and automatically discover network connection settings (if your network administrator has enabled this setting). Click the Tools menu, and then click Internet Options. On the Connections tab, click LAN Settings. Select Automatically detect settings, and then click OK. Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed. If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0. Click the Back button to try another link. Cannot find server or DNS Error Internet Explorer ******************* Thanks again, any advice is appreciated! Arka > Message: 2 > > Date: Sun, 04 Sep 2005 16:35:50 -0400 > From: Chris Beck <htm...@pa...> > To: htm...@li... > Subject: Re: [htmltmpl] Chain of forms, scripts and templates > > Hi Arka, > > HTTP is a somewhat stateless protocol, so in general the > post->template->post > round trip is perfectly safe. > > As far as I can tell, you seem to be doing things just fine. Does the > error > show up without SSL? Does it show up in non-IE browsers? You do not, > perchance, have any load-balancers in the equation do you? They can > sometimes > screw up SSL sessions. Is there any more detail in the error message > than "The > Page Cannot Be Displayed"? Is it an IE error or IE reporting a > server-side > error? Does anything show up in the server logs? > > > Rumour has it Arka Roy, on or about 04/09/2005 7:51 AM, whispered: > > Hi! > > > > I am an experienced C/C++ PC application programmer but a complete > > newbie to Perl, CGI, HTML::Templates, and internet programming > generally. > > > > I have created a simple sequence of forms, CGI scrips, and templates. > I > > am sometimes getting an error displaying the final template in > Internet > > Explorer when it is used under SSL. The "sometimes is the > disconcerting > > part. > > > > My question here is not so much about SSL, but if what I am doing is > > valid in the first place. > > To sum up here is what I am doing. > > > > HTML file with form -> cgi script -> template with form -> cgi script > -> > > template > > > > I am passing data from the forms to cgi via "post" and then using the > > Perl CGI "param" command. I am passing data from CGI to templates > using > > $template->param(). > > > > I get the "The page cannot be displayed" error in IE at the last > step, > > ie. when the last CGI script is trying to display the last template. > > > > The gory details are below, for your reference. But my question is > > pretty basic. Is is OK to display a template with a form in it, call > a > > CGI from that form, and have that CGI display another template? > > > > Thanks, > > Arka Roy > > > > ---------------- > > Access: https://ssl.somedomain.com/Login.html > > > > | > > | > > V > > > > Login.html > > --------- > > - user fills form > > - user presses submit > > > > | > > | > > V > > > > DisplayForm.cgi > > --------- > > my $template = HTML::Template->new( filename => 'Form.tmpl' ); > > $template->param( displayValue => $myValue ); > > print "Content-Type: text/html\n\n"; > > print $template->output; > > > > | > > | > > V > > > > Form.tmpl > > --------- > > - displays <tmpl_var name="displayValue"> > > - user fills form > > - user presses submit > > > > | > > | > > V > > > > SubmitData.cgi > > --------- > > my $template = HTML::Template->new( filename => 'SubmitDone.tmpl' ); > > $template->param( displayResult => $myResult ); > > print "Content-Type: text/html\n\n"; > > print $template->output; > > > > | > > | > > V > > > > SubmitDone.tmpl > > --------- > > - displays <tmpl_var name="displayResult"> > > ______________________________________________________ Click here to donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ |
From: Chris B. <htm...@pa...> - 2005-09-04 20:35:54
|
Hi Arka, HTTP is a somewhat stateless protocol, so in general the post->template->post round trip is perfectly safe. As far as I can tell, you seem to be doing things just fine. Does the error show up without SSL? Does it show up in non-IE browsers? You do not, perchance, have any load-balancers in the equation do you? They can sometimes screw up SSL sessions. Is there any more detail in the error message than "The Page Cannot Be Displayed"? Is it an IE error or IE reporting a server-side error? Does anything show up in the server logs? Rumour has it Arka Roy, on or about 04/09/2005 7:51 AM, whispered: > Hi! > > I am an experienced C/C++ PC application programmer but a complete > newbie to Perl, CGI, HTML::Templates, and internet programming generally. > > I have created a simple sequence of forms, CGI scrips, and templates. I > am sometimes getting an error displaying the final template in Internet > Explorer when it is used under SSL. The "sometimes is the disconcerting > part. > > My question here is not so much about SSL, but if what I am doing is > valid in the first place. > To sum up here is what I am doing. > > HTML file with form -> cgi script -> template with form -> cgi script -> > template > > I am passing data from the forms to cgi via "post" and then using the > Perl CGI "param" command. I am passing data from CGI to templates using > $template->param(). > > I get the "The page cannot be displayed" error in IE at the last step, > ie. when the last CGI script is trying to display the last template. > > The gory details are below, for your reference. But my question is > pretty basic. Is is OK to display a template with a form in it, call a > CGI from that form, and have that CGI display another template? > > Thanks, > Arka Roy > > ---------------- > Access: https://ssl.somedomain.com/Login.html > > | > | > V > > Login.html > --------- > - user fills form > - user presses submit > > | > | > V > > DisplayForm.cgi > --------- > my $template = HTML::Template->new( filename => 'Form.tmpl' ); > $template->param( displayValue => $myValue ); > print "Content-Type: text/html\n\n"; > print $template->output; > > | > | > V > > Form.tmpl > --------- > - displays <tmpl_var name="displayValue"> > - user fills form > - user presses submit > > | > | > V > > SubmitData.cgi > --------- > my $template = HTML::Template->new( filename => 'SubmitDone.tmpl' ); > $template->param( displayResult => $myResult ); > print "Content-Type: text/html\n\n"; > print $template->output; > > | > | > V > > SubmitDone.tmpl > --------- > - displays <tmpl_var name="displayResult"> -- Chris Beck - http://pacanukeha.blogspot.com understand, v: To reach a point, in your investigation of some subject, at which you cease to examine what is really present, and operate on the basis of your own internal model instead. |