html-template-users Mailing List for HTML::Template (Page 56)
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: Bryce P. <bp...@he...> - 2004-03-22 22:25:41
|
Hello, I have a subroutine which I use generically to call a bunch of different templates, depending on which page was called in the query string. Now my question is, is there a way to test if a template variable exists? I tried doing something along the lines of: if ($template->param('FOO_BAR')) { ... } But that doesn't seem to work. It doesn't give any errors, but it does not match properly. I did not know if maybe the underscore had something to do with it or not. Any suggestions / comments would greatly be appreciated. Regards, =20 Bryce Porter Network Administrator Heart Technologies, Inc. Direct 309-634-2282 Fax 309-634-2382 =20 |
From: Martijn v. d. B. <Mar...@as...> - 2004-03-22 08:00:22
|
> I looked at HTML::Pager and ran into the same standards compliance > issues (months ago). Eventually, I found it was much simpler and more > intuitive to use "Data::Page" and "Data::PageSet" to handle the > paging. Thanks for the tip, I'll check it out. Meanwhile, I hacked my copy of H::P to create the proper JavaScript tag :) -- </Martijn> 'practice random acts of kindness and senseless acts of beauty' -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. |
From: Mark S. <ma...@su...> - 2004-03-21 19:48:28
|
On 2004-03-18, Martijn van den Burg <Mar...@as...> wrote: > Hi, > > Since there's no list for HTML::Pager I thought I could get away with an > OT post in its companion module, H::T. > > H::P inserts the tag <SCRIPT LANGUAGE="Javascript"> at the position > where the template variable PAGER_JAVASCRIPT is inserted. My problem is > that this tag is not valid HTML 4.01 or XHTML, and hence my pages that > use H::P aren't, either. > > Proposed solution: change this tag into <script type="text/javascript"> > (lowercase chars). I looked at HTML::Pager and ran into the same standards compliance issues (months ago). Eventually, I found it was much simpler and more intuitive to use "Data::Page" and "Data::PageSet" to handle the paging. Because they don't generate /any/ HTML, you won't have these problems. You can also easily build your navigation using the HTML::Template API you are already used to. After rolling my own, and trying HTML::Pager, I've been quite happy with Data::Page and related modules for several projects. There is a bug report about the standards compliance issue here: http://rt.cpan.org/NoAuth/Bug.html?id=2471 The bug report has been open for 11 months, and HTML::Pager appears that it hasn't been updated for nearly 4 years. Mark -- http://mark.stosberg.com/ |
From: Clifton R. <cli...@ti...> - 2004-03-19 16:15:18
|
On Fri, Mar 19, 2004 at 01:11:04AM -0500, Cees Hek wrote: > Clifton Royston wrote: > > OK, I think I have this worked out. What was probably confusing us > >both is the builtin fallback (IIRC) to trying some different paths, > >including the current working dir, to load the templates from. The > >result is that if you are executing the script from the same relative > >path to the included files, it seems to work. > > OK, I can confirm this as a bug now. Thanks for doing the extra leg > work into narrowing down the problem! No sweat! Just so you know, it's not causing me any operational problems, as I now follow the "htmlclean" pass with a Perl one-liner that adds a newline before each tmpl_include. However, fixing it in a future release may save the next guy some problems. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Cees H. <ce...@si...> - 2004-03-19 06:11:20
|
Clifton Royston wrote: > OK, I think I have this worked out. What was probably confusing us > both is the builtin fallback (IIRC) to trying some different paths, > including the current working dir, to load the templates from. The > result is that if you are executing the script from the same relative > path to the included files, it seems to work. OK, I can confirm this as a bug now. Thanks for doing the extra leg work into narrowing down the problem! Cheers, Cees |
From: Clifton R. <cli...@ti...> - 2004-03-18 20:19:26
|
On Wed, Mar 17, 2004 at 11:45:42PM -0500, Cees Hek wrote: > Hi Clifton, > > I tried, but can't reproduce this problem. Can you include a small code > sample with templates that actually displays this problem. > > Also, it might help to tells us which version of HTML::Template and > which perl you are using (from the error message it looks like you are > using perl 5.6.1, but I can't guess what version of HTML::Template). > > I tested using HTML::Template 2.6 and perl 5.8.3 and didn't see a problem. HTML::Template 2.6 and perl 5.6.1 (correct!) both built from the FreeBSD ports system. (Well, from our own CVS copy of the FreeBSD ports tree, so that we have source control for absolute reproducibility, but that's probably irrelevant.) -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Clifton R. <cli...@ti...> - 2004-03-18 20:02:41
|
On Thu, Mar 18, 2004 at 09:15:25AM -1000, Clifton Royston wrote: > That must be a part of the problem. Quite odd. I am currently > unable to reproduce it myself with a very simple script, so there's > something about the broader execution environment going on here... > > I'll check back in once I have a script which reproduces it. OK, I think I have this worked out. What was probably confusing us both is the builtin fallback (IIRC) to trying some different paths, including the current working dir, to load the templates from. The result is that if you are executing the script from the same relative path to the included files, it seems to work. Here's the simplest scenario I can find to reproduce it. Files are in these relative paths: /home/cliftonr/work: a.html b.html c.html /home/cliftonr/work/htmltest: test-template.pl main.html /home/cliftonr/work/a.html: <b>Contents of template "a.html"</b> similarly for b.html and c.html /home/cliftonr/work/htmltest: #!/usr/bin/perl use HTML::Template; use constant TEMPLATE_DIR => '/home/cliftonr/work/html-test'; my $template = HTML::Template->new( filename => TEMPLATE_DIR . '/' . $ARGV[0] ); print $template->output( ); 1; /home/cliftonr/work/htmltest/main.html: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>Main</title></head> <body><div align=center style="height: 100%;"><table width=100% border="0" cells pacing="0" cellpadding="0" ><tr><td> <tmpl_include NAME="../a.html">after a</td></tr><tr><td> <tmpl_include NAME="../b.html">after b</td></tr> <tr><td> <tmpl_include NAME="../c.html"> </td></tr></table> </div></body></html> cd ~/work/html-test; ~/work/html-test/test-template.pl main.html [works normally, outputs template with all inclusions] cd /home/cliftonr/random1/random2; ~/work/html-test/test-template.pl main.html HTML::Template->new() : Cannot open included file ../c.html : file not found. at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 2180. Note that "a.html" is on its own line, and the following include of "b.html" works OK, but "b.html" and "c.html" are on the same line, and the second does not work. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Clifton R. <cli...@ti...> - 2004-03-18 19:15:27
|
On Thu, Mar 18, 2004 at 08:41:41AM -1000, Clifton Royston wrote: > On Thu, Mar 18, 2004 at 12:55:29AM -0500, Cees Hek wrote: > > Your explanation was very clear, I just can't reproduce the problem! I > > only get that error message if the ../home-template.html doesn't > > actually exist on the filesystem, which seems like the right thing for > > it to do. If the include files are there, it works fine for me... > > Maybe the error conditions are more restrictive than I thought, and > depend on parameters to the template load. That must be a part of the problem. Quite odd. I am currently unable to reproduce it myself with a very simple script, so there's something about the broader execution environment going on here... I'll check back in once I have a script which reproduces it. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Clifton R. <cli...@ti...> - 2004-03-18 18:41:48
|
On Thu, Mar 18, 2004 at 12:55:29AM -0500, Cees Hek wrote: > Clifton Royston wrote: > >On Wed, Mar 17, 2004 at 11:45:42PM -0500, Cees Hek wrote: > > > >>Hi Clifton, > >> > >>I tried, but can't reproduce this problem. Can you include a small code > >>sample with templates that actually displays this problem. > > > > > >Simply edit the template I provided as follows; I'm sorry my initial > >explanation was not clear enough: > > Your explanation was very clear, I just can't reproduce the problem! I > only get that error message if the ../home-template.html doesn't > actually exist on the filesystem, which seems like the right thing for > it to do. If the include files are there, it works fine for me... Maybe the error conditions are more restrictive than I thought, and depend on parameters to the template load. Let me try to simplify the execution environment and include that too. Right now the CGI which loads the template is far too complex to include here; it's loaded from within a module which does all kinds of login and session management, parameter presetting, etc. as well. I'll see if I can pare it down to the minimum. > By the way, I get the error message in line 2178 when the included file > doens't exist. This leads me to believe we are using different versions > of HTML::Template (or you have made some local enhancements?) I don't think so, but I will check if there are any patches applied as part of the FreeBSD port. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Martijn v. d. B. <Mar...@as...> - 2004-03-18 12:48:22
|
Hi, Since there's no list for HTML::Pager I thought I could get away with an OT post in its companion module, H::T. H::P inserts the tag <SCRIPT LANGUAGE="Javascript"> at the position where the template variable PAGER_JAVASCRIPT is inserted. My problem is that this tag is not valid HTML 4.01 or XHTML, and hence my pages that use H::P aren't, either. Proposed solution: change this tag into <script type="text/javascript"> (lowercase chars). Kind regards, -- </Martijn> 'practice random acts of kindness and senseless acts of beauty' -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. |
From: Cees H. <ce...@si...> - 2004-03-18 05:55:41
|
Clifton Royston wrote: > On Wed, Mar 17, 2004 at 11:45:42PM -0500, Cees Hek wrote: > >>Hi Clifton, >> >>I tried, but can't reproduce this problem. Can you include a small code >>sample with templates that actually displays this problem. > > > Simply edit the template I provided as follows; I'm sorry my initial > explanation was not clear enough: Your explanation was very clear, I just can't reproduce the problem! I only get that error message if the ../home-template.html doesn't actually exist on the filesystem, which seems like the right thing for it to do. If the include files are there, it works fine for me... By the way, I get the error message in line 2178 when the included file doens't exist. This leads me to believe we are using different versions of HTML::Template (or you have made some local enhancements?) Is it possible that you are using a version <= 2.4 and are getting hit by the following bug? - Bug Fix: nested include path handling was wrong Cheers, Cees > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> > <head><title>Community</title></head><body> > <div align=center style="height: 100%;"><table width=770 height="100%" > border="0" cellspacing="0" cellpadding="0" ><tr><td> > <tmpl_include NAME="../top.html"> </td></tr><tr><td><tmpl_include NAME="../home-template.html"> </td></tr> <tr><td> > <tmpl_include NAME="../bottom.html"> > </td></tr></table></div></body></html> > > That should generate this error when you do the "new" to load it: > > HTML::Template->new() : Cannot open included file ../home-template.html: > file not found. at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm > line 2180 > > On second thought, if it's still unclear, I'll write a tiny example in > the morning complete with the code to invoke it. > > -- Clifton > |
From: Clifton R. <cli...@ti...> - 2004-03-18 05:30:42
|
On Thu, Mar 18, 2004 at 03:22:49PM +1100, Mathew Robertson wrote: > you are absolutely correct. > > H::T uses the line count as a way to help figure out which included > file that it is currently processiong -> without the carriage return > character it cant figure out which file it is in. > > Also, the design of H::T relies on using line numbers for generating > meaningful error messages. > > I dont see how this problem can be solved without a change in design. > Maybe it just needs a note added to the perldoc... I'd suggest in that case that the error message returned in this situation should explicitly mention that each <tmpl_include> must be on its own line? I couldn't initially tell what feature of the "compression" on the file was causing the problem. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Clifton R. <cli...@ti...> - 2004-03-18 05:21:10
|
On Wed, Mar 17, 2004 at 11:45:42PM -0500, Cees Hek wrote: > Hi Clifton, > > I tried, but can't reproduce this problem. Can you include a small code > sample with templates that actually displays this problem. Simply edit the template I provided as follows; I'm sorry my initial explanation was not clear enough: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head><title>Community</title></head><body> <div align=center style="height: 100%;"><table width=770 height="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td> <tmpl_include NAME="../top.html"> </td></tr><tr><td><tmpl_include NAME="../home-template.html"> </td></tr> <tr><td> <tmpl_include NAME="../bottom.html"> </td></tr></table></div></body></html> That should generate this error when you do the "new" to load it: HTML::Template->new() : Cannot open included file ../home-template.html: file not found. at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 2180 On second thought, if it's still unclear, I'll write a tiny example in the morning complete with the code to invoke it. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Cees H. <ce...@si...> - 2004-03-18 04:45:54
|
Hi Clifton, I tried, but can't reproduce this problem. Can you include a small code sample with templates that actually displays this problem. Also, it might help to tells us which version of HTML::Template and which perl you are using (from the error message it looks like you are using perl 5.6.1, but I can't guess what version of HTML::Template). I tested using HTML::Template 2.6 and perl 5.8.3 and didn't see a problem. Cheers, Cees Clifton Royston wrote: > I probably won't be on this list too long, but wanted to pop in and > report a bug. Apparently if you have two or more <tmpl_include> tag on > a line, the second one always bombs. Here's a fairly simplified test > file for it: > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> > <head><title>Community</title></head><body> > <div align=center style="height: 100%;"><table width=770 height="100%" > border="0" cellspacing="0" cellpadding="0" ><tr><td> > <tmpl_include NAME="../top.html"> </td></tr><tr><td> > <tmpl_include NAME="../home-template.html"> </td></tr> <tr><td> > <tmpl_include NAME="../bottom.html"> > </td></tr></table></div></body></html> > > The three included templates in question exist in the right relative > location to the template. This template is processed properly. If the > first & second or second & third <tmpl_include> tags are simply joined > onto the same line, it bombs with this error: > > HTML::Template->new() : Cannot open included file ../home-template.html: file not found. > at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 2180 > > I ran into this immediately when I tried using the htmlclean script > (from HTML::Clean) to try to condense all our templates. This is > however the first bug I've run into in 6 to 8 months of working with > HTML::Template to build a web GUI. > > -- Clifton > |
From: Mathew R. <mat...@re...> - 2004-03-18 04:23:13
|
you are absolutely correct. H::T uses the line count as a way to help figure out which included file = that it is currently processiong -> without the carriage return = character it cant figure out which file it is in. Also, the design of H::T relies on using line numbers for generating = meaningful error messages. I dont see how this problem can be solved without a change in design. = Maybe it just needs a note added to the perldoc... Mathew ----- Original Message -----=20 From: "Clifton Royston" <cli...@ti...> To: <htm...@li...> Sent: Thursday, March 18, 2004 1:55 PM Subject: [htmltmpl] Stumbled on bug with multiple tmpl_include tags on = line > I probably won't be on this list too long, but wanted to pop in and > report a bug. Apparently if you have two or more <tmpl_include> tag = on > a line, the second one always bombs. Here's a fairly simplified test > file for it: >=20 > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> > <head><title>Community</title></head><body>=20 > <div align=3Dcenter style=3D"height: 100%;"><table width=3D770 = height=3D"100%"=20 > border=3D"0" cellspacing=3D"0" cellpadding=3D"0" ><tr><td> > <tmpl_include NAME=3D"../top.html"> </td></tr><tr><td> > <tmpl_include NAME=3D"../home-template.html"> </td></tr> <tr><td> > <tmpl_include NAME=3D"../bottom.html"> > </td></tr></table></div></body></html> >=20 > The three included templates in question exist in the right relative > location to the template. This template is processed properly. If = the > first & second or second & third <tmpl_include> tags are simply joined > onto the same line, it bombs with this error: >=20 > HTML::Template->new() : Cannot open included file = ../home-template.html: file not found.=20 > at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 2180 >=20 > I ran into this immediately when I tried using the htmlclean script > (from HTML::Clean) to try to condense all our templates. This is > however the first bug I've run into in 6 to 8 months of working with > HTML::Template to build a web GUI. =20 >=20 > -- Clifton >=20 > --=20 > Clifton Royston -- cli...@ti...=20 > Tiki Technologies Lead Programmer/Software Architect > Did you ever fly a kite in bed? Did you ever walk with ten cats on = your head? > Did you ever milk this kind of cow? Well we can do it. We know = how. > If you never did, you should. These things are fun, and fun is good. > -- = Dr. Seuss >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Clifton R. <cli...@ti...> - 2004-03-18 02:55:33
|
I probably won't be on this list too long, but wanted to pop in and report a bug. Apparently if you have two or more <tmpl_include> tag on a line, the second one always bombs. Here's a fairly simplified test file for it: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head><title>Community</title></head><body> <div align=center style="height: 100%;"><table width=770 height="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td> <tmpl_include NAME="../top.html"> </td></tr><tr><td> <tmpl_include NAME="../home-template.html"> </td></tr> <tr><td> <tmpl_include NAME="../bottom.html"> </td></tr></table></div></body></html> The three included templates in question exist in the right relative location to the template. This template is processed properly. If the first & second or second & third <tmpl_include> tags are simply joined onto the same line, it bombs with this error: HTML::Template->new() : Cannot open included file ../home-template.html: file not found. at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 2180 I ran into this immediately when I tried using the htmlclean script (from HTML::Clean) to try to condense all our templates. This is however the first bug I've run into in 6 to 8 months of working with HTML::Template to build a web GUI. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: Pete P. <pet...@cy...> - 2004-03-10 21:10:41
|
>>Ah, now I see. I read the text you wrote instead of the regex because, >>you know, I'm not a regex engine. ;) >> >>Of course *had* I properly read the regex you wrote, I would have >>figured it out. > > > :-) > > >>Couldn't you use a case-insensitive match though to avoid the >>[Tt][Mm][Pp][Ll] part? > > > yep - but it would probably be about 10 times slower, as m//i makes a copy of the input string. > > There are a number of places on the web which document this fact - until the perl regex engine gets smarter, then the [...] syntax is the best way to go Well, gee - you learn something new everyday! - Thanks! Pete |
From: Mathew R. <mat...@re...> - 2004-03-08 22:48:50
|
> Ah, now I see. I read the text you wrote instead of the regex because, = > you know, I'm not a regex engine. ;) >=20 > Of course *had* I properly read the regex you wrote, I would have=20 > figured it out. :-) > Couldn't you use a case-insensitive match though to avoid the=20 > [Tt][Mm][Pp][Ll] part? yep - but it would probably be about 10 times slower, as m//i makes a = copy of the input string. There are a number of places on the web which document this fact - until = the perl regex engine gets smarter, then the [...] syntax is the best = way to go Mathew |
From: Pete P. <pet...@cy...> - 2004-03-08 16:40:05
|
Mathew Robertson wrote: >>>I was looking through H::T when I noticed that it splits the incoming template using: >>> >>> split ( /(?<=)/ , $template) >>> >>>This regex ends up splitting on every '<'. >>> >>>I have modified my version to use: >>> >>> split( m!(?=<(?:\!--\s*)?/?[Tt][Mm][Pp][Ll]_)! , $template) >>> >>>which thus matches only on <TMPL_ and </TMPL_ tags. >>> >> >>Won't this break if you use the <!-- TMPL... --> constructs of putting >>the TMPL tags within HTML comments? > > > Not from my testing it didn't; this regex only matches on: > > <TMPL_ > </TMPL_ > <!-- TMPL_ > <!-- /TMPL_ > > doesn't matter where the TMPL_ construct is located. > > However you could be right as there may be some cases where the regex doesn't quite match correctly, although I cant think of such a situation. Ah, now I see. I read the text you wrote instead of the regex because, you know, I'm not a regex engine. ;) Of course *had* I properly read the regex you wrote, I would have figured it out. Couldn't you use a case-insensitive match though to avoid the [Tt][Mm][Pp][Ll] part? Pete |
From: Mathew R. <mat...@re...> - 2004-03-05 03:20:35
|
yep H::T is very good at this - and you could probably something simple = like this, in less than 50 lines of code. Mathew ----- Original Message -----=20 From: J C=20 To: htm...@li...=20 Sent: Friday, March 05, 2004 7:03 AM Subject: [htmltmpl] Using HTML::Template I need to be able to do the following with a Perl script and send out = emails via HTML or text (if they don't want HTML emails): I need to read in a file that would contain information like (customer = id, first name, last name, address, etc.) I really don't want the HTML tags in the Perl script. I'll be sending = different email messages, so I would prefer separate HTML = files/templates--not sure how to do this. I also need to be able to = include images.=20 For example, one email might read: Dear <first name><last name>, Thank you for blah blah blah. Another <variable>. Another one might be: The following information is on file: <first name><last name> <address> Blah blah blah Is HTML::Template the best way to do this? Does it still work if I = need a text version. Thank you very much! -------------------------------------------------------------------------= ----- Do you Yahoo!? Yahoo! Search - Find what you're looking for faster. |
From: Mathew R. <mat...@re...> - 2004-03-04 22:16:04
|
> > I was looking through H::T when I noticed that it splits the = incoming template using: > >=20 > > split ( /(?<=3D)/ , $template) > >=20 > > This regex ends up splitting on every '<'. > >=20 > > I have modified my version to use: > >=20 > > split( m!(?=3D<(?:\!--\s*)?/?[Tt][Mm][Pp][Ll]_)! , $template) > >=20 > > which thus matches only on <TMPL_ and </TMPL_ tags. > >=20 >=20 > Won't this break if you use the <!-- TMPL... --> constructs of putting = > the TMPL tags within HTML comments? Not from my testing it didn't; this regex only matches on: <TMPL_ </TMPL_ <!-- TMPL_ <!-- /TMPL_ doesn't matter where the TMPL_ construct is located. However you could be right as there may be some cases where the regex = doesn't quite match correctly, although I cant think of such a = situation. cheers, Mathew |
From: Pete P. <pet...@cy...> - 2004-03-04 21:20:44
|
Mathew Robertson wrote: > Hi Sam, > > I was looking through H::T when I noticed that it splits the incoming template using: > > split ( /(?<=)/ , $template) > > This regex ends up splitting on every '<'. > > I have modified my version to use: > > split( m!(?=<(?:\!--\s*)?/?[Tt][Mm][Pp][Ll]_)! , $template) > > which thus matches only on <TMPL_ and </TMPL_ tags. > Won't this break if you use the <!-- TMPL... --> constructs of putting the TMPL tags within HTML comments? Pete |
From: J C <jsh...@ya...> - 2004-03-04 20:17:56
|
I need to be able to do the following with a Perl script and send out emails via HTML or text (if they don't want HTML emails): I need to read in a file that would contain information like (customer id, first name, last name, address, etc.) I really don't want the HTML tags in the Perl script. I'll be sending different email messages, so I would prefer separate HTML files/templates--not sure how to do this. I also need to be able to include images. For example, one email might read: Dear <first name><last name>, Thank you for blah blah blah. Another <variable>. Another one might be: The following information is on file: <first name><last name> <address> Blah blah blah Is HTML::Template the best way to do this? Does it still work if I need a text version. Thank you very much! --------------------------------- Do you Yahoo!? Yahoo! Search - Find what youre looking for faster. |
From: Mathew R. <mat...@re...> - 2004-03-01 03:33:06
|
> > I often find myself generating template code such as: > > > > <TMPL_UNLESS error> > > <TMPL_UNLESS print> > > <TMPL_IF some_var> > > .... do something... > > </TMPL_IF> > > </TMPL_UNLESS> > > </TMPL_UNLESS> >=20 > When I see stuff like that I go into my Perl code and whip up > something like: >=20 > <tmpl_if no_error_and_no_print> > ... do something ... > </tmpl_if> >=20 > <tmpl_if no_error> > ... do something else ... >=20 > <tmpl_if error> > ... do something else entirely ... > </tmpl_if> >=20 > That way the template stays simple and I concentrate the complex logic > in the Perl code where it belongs. If possible I try to find a way to > phrase each condition that doesn't involve boolean logic, which few > non-programmers fully understand. Thats ok - except that since 'error' and 'print' are orthogonal concepts = - the metaphore of not displaying either is really a user-interface = problem, not an application problem. As such, to generate the = 'no_error_and_no_print' value, the programmer would need to either: a) get a set of requirements form the UI guy which states what extra = variables need to be coded up, b) automatically generate arbitrary names for each combination of = template parameters, just in case the UI guy needs them. In either case, we increase coupling between the UI and the backend = application code. > > The equivalent using H::T::E would be: > > > > <TMPL_UNLESS EXPR=3D"((defined error) or (defined print)) and ...."> > > ... do something... > > </TMPL_UNLESS> >=20 > You can write that a little simpler: >=20 > <TMPL_UNLESS EXPR=3D"((error or print) and ...)"> 'error' in scalar context, means something slightly different than = 'defined(error)' - however, you are correct for this rather poor example = of mine... >=20 > > both syntax's are reasonably ugly... >=20 > Beauty is in the eye of the beholder... >=20 > > What about a syntax like: > > > > <TMPL_IF !error,!print,some_var> >=20 > ...which is proven by the fact that I find this much uglier than > either of the two alternatives! touche... cheers, Mathew |
From: Sam T. <sa...@tr...> - 2004-02-26 02:26:39
|
On Thu, 26 Feb 2004, Mathew Robertson wrote: > We also use Apache/mod_perl. The reason is that quite often there > will be 20 instances of Apache running (ie we get may requests per > second). I'd like to reduce the memory usage a bit. And yes I know > that running H::T::E is slow, but speed is not the problem, where as > memory pressure can be (on ocassions). Just pre-load your templates during Apache startup. There's an example in the FAQ section of the HTML::Template docs. -sam |