html-template-users Mailing List for HTML::Template (Page 9)
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 F. <azf...@gm...> - 2007-12-18 17:11:55
|
On 12/16/07, Brad Baxter <bm...@ma...> wrote: > A template novice might complain that HTML::Template is adding extra > line breaks, but of course, they are right there in the template. I'm not a template novice and I still complain about the extra line breaks. I think it's debatable whether "they are right there in the template." If the lines the <tmpl_*> tags are on are not actually (template) content, I don't see why the line ends of those lines should be considered emitable (template) content. The fact that so many novices find this unintuitive would indicate it's not the correct behavior. But, if it would burden H:T with cumbersome logic, I've always been in favor of leaving it alone for the sake of simplicity (which I like about H:T). Mark |
From: C H. <hag...@ep...> - 2007-12-16 19:40:19
|
>What kind of server is it on? RedHat/Apache .... it's "our" server (we're the only ones with access to the machine), with root access limited to myself and one other programmer more savvy then me, and neither of us have accessed the machine. We also have a SSH and FTP script that sends us logon events and there was no host access in the time frame of the change. We also specifically requested *not* to have any "auto-updates" of the OS and related items. It's really weird, and I know at some point, we'll find the cause ... and wouldn't be surprised if it turns out to be a "duh" event. I'll certainly post to the list when we do pin it down. Appreciate the input, and if you have any other random thoughts, don't hesitate to pass them along Carl At 01:05 PM 12/16/2007, al...@lo... wrote: > > look at me like I must be off my medication .... >Must have not been good for you anyway. > >And you didn't open and save the files with a mac? > >I put your template section in one of my templates. >Here is the result: > >########################################## >=> this represents line 1 >=> this represents line 2 >=> this represents line 3 >=> this represents line 4 >=> this represents line 5 >########################################## > > >I haven't updated my Template modules for at least a year, maybe two. so >it could be something in the Template system that has changed >or something weird in your machine. >I remember I was using a perl categorizer and there was an auto update and >it wrecked my whole categorization system, so I stopped updates. > >What kind of server is it on? > >Alan >NewsBlaze.com > > > > >C Hagstrom wrote: >>Thanks for the response .... you mention: >> >>-------------------------- >>The above doesn't look like a template file, so I'm >>not sure I'm actually answering your question, but I tried a couple of >>things. >> >>1. I put the above <template></template> lines in a file named qt.tmpl, >>and ran the following code: >>-------------------------- >> >> >>>><output> >>>>########################################## >>>> >>>>=> this represents line 1 >>>> >>>>=> this represents line 2 >>>> >>>>=> this represents line 3 >>>> >>>>=> this represents line 4 >>>> >>>>=> this represents line 5 >>>> >>>>########################################## >>>></output> >>>> >>>>Note: the Template file used for the above appears as: >>>> >>><template> >>>########################################## >>>=> this represents line 1 >>>=> this represents line 2 >>>=> this represents line 3 >>>=> this represents line 4 >>>=> this represents line 5 >>>########################################## >>></template> >>> >>> > C. Hagstrom hag...@ep... |
From: <al...@lo...> - 2007-12-16 18:05:49
|
> look at me like I must be off my medication .... Must have not been good for you anyway. And you didn't open and save the files with a mac? I put your template section in one of my templates. Here is the result: ########################################## => this represents line 1 => this represents line 2 => this represents line 3 => this represents line 4 => this represents line 5 ########################################## I haven't updated my Template modules for at least a year, maybe two. so it could be something in the Template system that has changed or something weird in your machine. I remember I was using a perl categorizer and there was an auto update and it wrecked my whole categorization system, so I stopped updates. What kind of server is it on? Alan NewsBlaze.com C Hagstrom wrote: > Thanks for the response .... you mention: > > -------------------------- > The above doesn't look like a template file, so I'm > not sure I'm actually answering your question, but I tried a couple of things. > > 1. I put the above <template></template> lines in a file named qt.tmpl, > and ran the following code: > -------------------------- > > >>> <output> >>> ########################################## >>> >>> => this represents line 1 >>> >>> => this represents line 2 >>> >>> => this represents line 3 >>> >>> => this represents line 4 >>> >>> => this represents line 5 >>> >>> ########################################## >>> </output> >>> >>> Note: the Template file used for the above appears as: >>> >> <template> >> ########################################## >> => this represents line 1 >> => this represents line 2 >> => this represents line 3 >> => this represents line 4 >> => this represents line 5 >> ########################################## >> </template> >> >> |
From: C H. <hag...@ep...> - 2007-12-16 17:29:03
|
Thanks for the response .... you mention: -------------------------- The above doesn't look like a template file, so I'm not sure I'm actually answering your question, but I tried a couple of things. 1. I put the above <template></template> lines in a file named qt.tmpl, and ran the following code: -------------------------- What you placed in your qt.tmpl file is what is in my template file as well .... it's simple a .tmpl file with the content of what goes into the body of an email message. We have set things up this way so non-code people could revise the email output without touching the actual script file. Again, the template file is a "bare" text file with a .tmpl extension .... no variables/loops involved - simply there for non-programmers to access. Probably the most salient issue is the fact that the output of these templates has been fine for a long time (some well over a year, with no changes to the template file during that time), and just last week the line breaks "doubled up". My instincts tell me that this points to some sort of system change, but again, we're pretty confident there has been no changes at the system level, so I'm not sure what can be causing this event. It's really got me baffled, and about the only common denominator I can find is that the problem only occurs in email messages where the body of the message is called at the script level using HTML Template. Print statements to the email body within the script don't display this problem. It really makes no sense, but it's happening, and I'm the one that's got to fix it. And of course when I tell others that I don't have any clue what-so-ever, they kinda look at me like I must be off my medication .... At 11:41 AM 12/16/2007, Brad Baxter wrote: >On Dec 15, 2007 10:55 AM, C Hagstrom ><<mailto:hag...@ep...>hag...@ep...> wrote: > >This script code: > > > ><code> > >my $template = HTML::Template->new( > > filename => "$tmpl_dir/CH_line_break_test.tmpl", > > associate => $q, > >); > >$stuff = $template->output; > > > >print MAIL $stuff; > ></code> > > > >comes through as: > > > ><output> > >########################################## > > > >=> this represents line 1 > > > >=> this represents line 2 > > > >=> this represents line 3 > > > >=> this represents line 4 > > > >=> this represents line 5 > > > >########################################## > ></output> > > > >Note: the Template file used for the above appears as: > ><template> >########################################## >=> this represents line 1 >=> this represents line 2 >=> this represents line 3 >=> this represents line 4 >=> this represents line 5 >########################################## ></template> > > > >Well, I'm a bit confused. The above doesn't look like a template file, so >I'm >not sure I'm actually answering your question, but I tried a couple of things. > >1. I put the above <template></template> lines in a file named qt.tmpl, >and ran the following code: > > 1 #!/usr/local/bin/perl > 2 > 3 use strict; > 4 use warnings; > 5 use HTML::Template; > 6 > 7 my $template = HTML::Template->new( filename => "qt.tmpl" ); > 8 my $stuff = $template->output; > 9 print $stuff; > >I got the following output: > >########################################## >=> this represents line 1 >=> this represents line 2 >=> this represents line 3 >=> this represents line 4 >=> this represents line 5 >########################################## > >(Question: is that *really* your template file contents?) > > >2. The problem you describe reminds me of the classic beef about >extra line breaks when a template is filled in. Of course, these >aren't really *extra*, because the template file contains them. For >example, when I run the following code: > > 1 #!/usr/local/bin/perl > 2 > 3 use strict; > 4 use warnings; > 5 use HTML::Template; > 6 > 7 my @array = <DATA>; > 8 my $template = HTML::Template->new( arrayref => \@array ); > 9 $template->param( loop => [ > 10 {line => "line1"}, > 11 {line => "line2"}, > 12 {line => "line3"}, > 13 ] ); > 14 my $stuff = $template->output; > 15 print $stuff; > 16 > 17 __DATA__ > 18 ########################################## > 19 <TMPL_LOOP name="loop"> > 20 <TMPL_VAR name="line"> > 21 </TMPL_LOOP> > 22 ########################################## > >I get the following output: > >########################################## > >line1 > >line2 > >line3 > >########################################## > >A template novice might complain that HTML::Template is adding extra >line breaks, but of course, they are right there in the template. I don't >think that you're a template novice, so again I'm not sure this is answering >your question. > >You say that nothing in your templates has changed. However, >I don't think you have given a real example of one of these templates, >so beyond my guesses above, it's hard for me to know what will help. > >Regards, > >-- Brad C. Hagstrom hag...@ep... |
From: Brad B. <bm...@ma...> - 2007-12-16 16:41:12
|
On Dec 15, 2007 10:55 AM, C Hagstrom <hag...@ep...> wrote: > >This script code: > > > ><code> > >my $template = HTML::Template->new( > > filename => "$tmpl_dir/CH_line_break_test.tmpl", > > associate => $q, > >); > >$stuff = $template->output; > > > >print MAIL $stuff; > ></code> > > > >comes through as: > > > ><output> > >########################################## > > > >=> this represents line 1 > > > >=> this represents line 2 > > > >=> this represents line 3 > > > >=> this represents line 4 > > > >=> this represents line 5 > > > >########################################## > ></output> > > > >Note: the Template file used for the above appears as: > > <template> > ########################################## > => this represents line 1 > => this represents line 2 > => this represents line 3 > => this represents line 4 > => this represents line 5 > ########################################## > </template> > Well, I'm a bit confused. The above doesn't look like a template file, so I'm not sure I'm actually answering your question, but I tried a couple of things. 1. I put the above <template></template> lines in a file named qt.tmpl, and ran the following code: 1 #!/usr/local/bin/perl 2 3 use strict; 4 use warnings; 5 use HTML::Template; 6 7 my $template = HTML::Template->new( filename => "qt.tmpl" ); 8 my $stuff = $template->output; 9 print $stuff; I got the following output: ########################################## => this represents line 1 => this represents line 2 => this represents line 3 => this represents line 4 => this represents line 5 ########################################## (Question: is that *really* your template file contents?) 2. The problem you describe reminds me of the classic beef about extra line breaks when a template is filled in. Of course, these aren't really *extra*, because the template file contains them. For example, when I run the following code: 1 #!/usr/local/bin/perl 2 3 use strict; 4 use warnings; 5 use HTML::Template; 6 7 my @array = <DATA>; 8 my $template = HTML::Template->new( arrayref => \@array ); 9 $template->param( loop => [ 10 {line => "line1"}, 11 {line => "line2"}, 12 {line => "line3"}, 13 ] ); 14 my $stuff = $template->output; 15 print $stuff; 16 17 __DATA__ 18 ########################################## 19 <TMPL_LOOP name="loop"> 20 <TMPL_VAR name="line"> 21 </TMPL_LOOP> 22 ########################################## I get the following output: ########################################## line1 line2 line3 ########################################## A template novice might complain that HTML::Template is adding extra line breaks, but of course, they are right there in the template. I don't think that you're a template novice, so again I'm not sure this is answering your question. You say that nothing in your templates has changed. However, I don't think you have given a real example of one of these templates, so beyond my guesses above, it's hard for me to know what will help. Regards, -- Brad |
From: C H. <hag...@ep...> - 2007-12-16 15:20:17
|
Regarding my earlier question about the appearance of "double" line breaks where previously there was one, and the response by Alex: <comment> My two guesses (I havn't tried any code): - the template file contains both \n and \r courtesy of your text editor and perhaps unbeknownst to you. The \r is getting expanded to an extra \n. Run the template file through unix2dos or an equivalent command to eliminate the extra line endings. - the association to $q you are using is changing things. Whats happens if you don't use the association? </comment> One item worth of mention is that the double line break problem I'm now seeing just recently started appearing in template output (at least 30 templates ... maybe more) that hasn't changed or been revised in some cases for over a year. I'm also fairly confident that there were no system changes recently. The behavior points to some sort of systems event, but again, nothing has changed at the system level. Since this is a vexing problem, I was hoping there might be list members who have run across a similar event. C. Hagstrom hag...@ep... |
From: Alex T. <al...@ac...> - 2007-12-15 16:21:54
|
My two guesses (I havn't tried any code): - the template file contains both \n and \r courtesy of your text editor and perhaps unbeknownst to you. The \r is getting expanded to an extra \n. Run the template file through unix2dos or an equivalent command to eliminate the extra line endings. - the association to $q you are using is changing things. Whats happens if you don't use the association? HTH, Alex On Sat, 15 Dec 2007 10:55:04 -0500, C Hagstrom wrote > I must apologize .... my most recent note contained an error > in description ... below is what the correct explanation of > my problem. > ------------------ > > >I've recently encountered a very strange issue that appears > >to be related to HTML::Template > > > >I have many scripts at my site that generate email > >messages, and I've noticed that the ones that > >use HTML::Template to generate the body of the > >message have recently been coming through with > >"doubled up" line break. In other words, message > >content that was formerly single spaced is now > >double spaced. > > > >I've tested this by creating a script with various > >approaches to generating the email message content, > >and the only portion of the content that exhibits this > >extra line break behavior is the portion that > >is run through HTML::Template. > > > >Has anyone else experienced this issue, and if > >so, figured out the cause? > > > >Any thoughts on what might cause such behavior? > >We're running Apache/Perl on a Linux RedHat system > > > >This script code: > ><code> > >print MAIL "####### DIRECTLY QUOTED PRINT STATEMENT ##\n"; > >print MAIL "Single spaced lines between hash marks\n"; > >print MAIL "=> this represents line 1\n"; > >print MAIL "=> this represents line 2\n"; > >print MAIL "=> this represents line 3\n"; > >print MAIL "=> this represents line 4\n"; > >print MAIL "=> this represents line 5\n"; > >print MAIL "####### DIRECTLY QUOTED PRINT STATEMENT ##\n"; > ></code> > > > >comes through as: > > > ><output> > >########################################## > >Single spaced lines between hash marks > >=> this represents line 1 > >=> this represents line 2 > >=> this represents line 3 > >=> this represents line 4 > >=> this represents line 5 > >########################################## > ></output> > > > >This script code: > > > ><code> > >my $template = HTML::Template->new( > > filename => "$tmpl_dir/CH_line_break_test.tmpl", > > associate => $q, > >); > >$stuff = $template->output; > > > >print MAIL $stuff; > ></code> > > > >comes through as: > > > ><output> > >########################################## > > > >=> this represents line 1 > > > >=> this represents line 2 > > > >=> this represents line 3 > > > >=> this represents line 4 > > > >=> this represents line 5 > > > >########################################## > ></output> > > > >Note: the Template file used for the above appears as: > > <template> > ########################################## > => this represents line 1 > => this represents line 2 > => this represents line 3 > => this represents line 4 > => this represents line 5 > ########################################## > </template> > > >C. Hagstrom > >hag...@ep... > > > > C. Hagstrom > hag...@ep... > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services > for just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: C H. <hag...@ep...> - 2007-12-15 15:55:13
|
I must apologize .... my most recent note contained an error in description ... below is what the correct explanation of my problem. ------------------ >I've recently encountered a very strange issue that appears >to be related to HTML::Template > >I have many scripts at my site that generate email >messages, and I've noticed that the ones that >use HTML::Template to generate the body of the >message have recently been coming through with >"doubled up" line break. In other words, message >content that was formerly single spaced is now >double spaced. > >I've tested this by creating a script with various >approaches to generating the email message content, >and the only portion of the content that exhibits this >extra line break behavior is the portion that >is run through HTML::Template. > >Has anyone else experienced this issue, and if >so, figured out the cause? > >Any thoughts on what might cause such behavior? >We're running Apache/Perl on a Linux RedHat system > >This script code: ><code> >print MAIL "####### DIRECTLY QUOTED PRINT STATEMENT ##\n"; >print MAIL "Single spaced lines between hash marks\n"; >print MAIL "=> this represents line 1\n"; >print MAIL "=> this represents line 2\n"; >print MAIL "=> this represents line 3\n"; >print MAIL "=> this represents line 4\n"; >print MAIL "=> this represents line 5\n"; >print MAIL "####### DIRECTLY QUOTED PRINT STATEMENT ##\n"; ></code> > >comes through as: > ><output> >########################################## >Single spaced lines between hash marks >=> this represents line 1 >=> this represents line 2 >=> this represents line 3 >=> this represents line 4 >=> this represents line 5 >########################################## ></output> > >This script code: > ><code> >my $template = HTML::Template->new( > filename => "$tmpl_dir/CH_line_break_test.tmpl", > associate => $q, >); >$stuff = $template->output; > >print MAIL $stuff; ></code> > >comes through as: > ><output> >########################################## > >=> this represents line 1 > >=> this represents line 2 > >=> this represents line 3 > >=> this represents line 4 > >=> this represents line 5 > >########################################## ></output> > >Note: the Template file used for the above appears as: <template> ########################################## => this represents line 1 => this represents line 2 => this represents line 3 => this represents line 4 => this represents line 5 ########################################## </template> >C. Hagstrom >hag...@ep... > C. Hagstrom hag...@ep... |
From: C H. <hag...@ep...> - 2007-12-15 15:48:09
|
I've recently encountered a very strange issue that appears to be related to HTML::Template I have many scripts at my site that generate email messages, and I've noticed that the ones that use HTML::Template to generate the body of the message have recently been coming through with "doubled up" line break. In other words, message content that was formerly single spaced is now double spaced. I've tested this by creating a script with various approaches to generating the email message content, and the only portion of the content that exhibits this extra line break behavior is the portion that is run through HTML::Template. Has anyone else experienced this issue, and if so, figured out the cause? Any thoughts on what might cause such behavior? We're running Apache/Perl on a Linux RedHat system This script code: <code> print MAIL "####### DIRECTLY QUOTED PRINT STATEMENT ##\n"; print MAIL "Single spaced lines between hash marks\n"; print MAIL "=> this represents line 1\n"; print MAIL "=> this represents line 2\n"; print MAIL "=> this represents line 3\n"; print MAIL "=> this represents line 4\n"; print MAIL "=> this represents line 5\n"; print MAIL "####### DIRECTLY QUOTED PRINT STATEMENT ##\n"; </code> comes through as: <output> ########################################## Single spaced lines between hash marks => this represents line 1 => this represents line 2 => this represents line 3 => this represents line 4 => this represents line 5 ########################################## </output> This script code: <code> my $stuff = "######## HTML TEMPLATE ###################\n"; "=> this represents line 1\n"; "=> this represents line 2\n"; "=> this represents line 3\n"; "=> this represents line 4\n"; "=> this represents line 5\n"; "######## HTML TEMPLATE ###################\n"; ; my $template = HTML::Template->new( filename => "$tmpl_dir/CH_line_break_test.tmpl", associate => $q, ); $stuff = $template->output; print MAIL $stuff; </code> comes through as: <output> ########################################## => this represents line 1 => this represents line 2 => this represents line 3 => this represents line 4 => this represents line 5 ########################################## </output> C. Hagstrom hag...@ep... |
From: Kapoor, N. <nis...@xc...> - 2007-11-02 13:05:43
|
> Change your code to open the other template and paste its output into = the > template with a simple TMPL_VAR. > > -Sven Thank you (and Jason) for your prompt response. I was thinking the same, but was reluctant since it makes the code a bit = untidy. Thanks again, Nishi |
From: Jason P. <ja...@jo...> - 2007-11-02 13:00:14
|
The way I would do it is make two templates. Instead of the tmpl_include, you would have something like <tmpl_var name="subcontent"> Then in your code, you would create a 'fragment' template object based on the myDir/my.tmpl and then pass that template object output() into your parent template as the 'subcontent' parameter. HTH, Jason Kapoor, Nishikant wrote: > Hello all, > > I have a need to include a template based on a certain condition i.e., I would like to be able to do > > <tmpl_include "<tmpl_var myDir>/my.tmpl"> > > where I can set myDir. Browsing the archives suggests that this functionality is presently not available. Since there is a long list of possible values that myDir can assume, <tmpl_if><tmpl_else> is not a feasible option. > > Any suggestions? > > Thanks, > Nishi > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Sven N. <sve...@sv...> - 2007-11-02 12:59:07
|
Kapoor, Nishikant schrieb: > Hello all, > > I have a need to include a template based on a certain condition i.e., I would like to be able to do > > <tmpl_include "<tmpl_var myDir>/my.tmpl"> > > where I can set myDir. Browsing the archives suggests that this functionality is presently not available. Since there is a long list of possible values that myDir can assume, <tmpl_if><tmpl_else> is not a feasible option. > > Any suggestions? Change your code to open the other template and paste its output into the template with a simple TMPL_VAR. -Sven |
From: Kapoor, N. <nis...@xc...> - 2007-11-02 12:51:01
|
Hello all, I have a need to include a template based on a certain condition i.e., I = would like to be able to do <tmpl_include "<tmpl_var myDir>/my.tmpl"> where I can set myDir. Browsing the archives suggests that this = functionality is presently not available. Since there is a long list of = possible values that myDir can assume, <tmpl_if><tmpl_else> is not a = feasible option. Any suggestions? Thanks, Nishi |
From: Mathew R. <mat...@ne...> - 2007-11-01 04:08:47
|
Hi list, Sometime ago I posted a message regarding having an updated H::T which had support for "die_on_missing_params" - a feature requested by Joshua Ball. As a side effect of a machine update, I have managed to loose the patch... If Joshua is still on the list, could you please email me updated module. cheers, Mathew Robertson |
From: Mathew R. <mat...@ne...> - 2007-10-29 23:46:06
|
I use a modified version of H::T that allows the TMPL_xxx syntax to grow and which has support for dynamic loading of the escaping modules. I also tend to use some specific filters. So "no, not H::T::A" or other modules, and "yes, some locally modified stuff". regards, Mathew Robert Hicks wrote: > Do any of you use the HTML::Template::Associate modules or other H::T > helper type modules? > > Robert > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Robert H. <si...@gm...> - 2007-10-27 01:26:09
|
Do any of you use the HTML::Template::Associate modules or other H::T helper type modules? Robert |
From: <mad...@fr...> - 2007-10-25 23:40:32
|
Robert Hicks wrote: > S=E9bastien Aperghis-Tramoni wrote: > >> This mail just to announce that I've put on the CPAN a new syntax >> filter for HTML::Template, offering a TT2-like syntax. > > Hey that is pretty neat. :-) Thanks :-) Lee Goddard wrote: > Why? ;-) Simple: HTML::Template is fine for small templates, but its syntax is =20= far too verbose, and as I'm using TT2 in other places, I felt as re-=20 using its syntax here as well, hence the filter. The other thing now is that I had forgot how debugging errors in HT =20 templates was painful. --=20 S=E9bastien Aperghis-Tramoni Close the world, txEn eht nepO. |
From: Robert H. <si...@gm...> - 2007-10-25 18:57:47
|
Sébastien Aperghis-Tramoni wrote: > Hello fellow HTML::Template users, > > > This mail just to announce that I've put on the CPAN a new syntax > filter for HTML::Template, offering a TT2-like syntax. > > » http://search.cpan.org/dist/HTML-Template-Filter-TT2/ > > Hey that is pretty neat. :-) Robert |
From: <mad...@fr...> - 2007-10-25 17:54:11
|
Hello fellow HTML::Template users, This mail just to announce that I've put on the CPAN a new syntax =20 filter for HTML::Template, offering a TT2-like syntax. =BB http://search.cpan.org/dist/HTML-Template-Filter-TT2/ --=20 S=E9bastien Aperghis-Tramoni Close the world, txEn eht nepO. |
From: <htm...@to...> - 2007-09-26 18:54:31
|
(Tested with HTML::Template 2.8 and 2.9) The following looks like a bug to me: Program: +++++++++++++++++++++++++++++++++++++++++++++++++ #!/usr/bin/perl -w use HTML::Template; my $template = <<EOF; <TMPL_LOOP NAME=diff> <TMPL_LOOP NAME=Drop>first</TMPL_LOOP> <TMPL_LOOP NAME=Mapping > <TMPL_LOOP NAME=Drop>second</TMPL_LOOP> </TMPL_LOOP> </TMPL_LOOP> EOF my $t = HTML::Template->new_scalar_ref(\$template, global_vars => 1); $t->param (diff => [{ # Drop => [{}], 'Mapping' => [{}], }],); print $t->output; ------------------------------------------------- Gives as result: +++++++++++++++++++++++++++++++++++++++++++++++++ HTML::Template->output() : fatal error in loop output : HTML::Template->output() : fatal error in loop output : HTML::Template::param() : attempt to set parameter 'drop' with a scalar - parameter is not a TMPL_VAR! at /usr/lib/perl5/site_perl/5.8.4/HTML/Template.pm line 2998 at /usr/lib/perl5/site_perl/5.8.4/HTML/Template.pm line 2998 at ./test.pl line 19 ------------------------------------------------- So the first TMPL_LOOP NAME=Drop somehow destroys the the working of the second one. Removing either of these loops makes everything work. Also removing the outer diff level in the template text and the params makes it work. Also removing global_vars => 1 makes this work Uncommenting the # Drop => [{}], line in the code makes the output be: +++++++++++++++++++++++++++++++++++++++++++++++++ first second ------------------------------------------------- That is also wrong I think since the docs are quite clear that there isn't supposed to be a "global_loops" implied by global_vars. Only "first" should have printed. -- Your money back if not satisfied! (However, we suspect that we will be quite satisfied with your money) |
From: Karen <kar...@gm...> - 2007-09-16 22:56:45
|
On 9/16/07, Tom Kopke <to...@tc...> wrote: > > Line 468 reads: > my $template = HTML::Template->new(filename => $pperror_template); > > An earlier instance calling HTML::Template in the same file works > fine. > $pperror_template is, or has gotten, undefined. You can confirm this by replacing '$pperror_template' with '$pperror_template || q{}' at which point you'll get an error complaining about the blank (vs. undefined) filename. |
From: Tom K. <to...@tc...> - 2007-09-16 22:43:15
|
I'm getting the below server error. HTML::Template->new() called with odd number of option parameters - should be of the form option => value at 11102post.pl line 468 Line 468 reads: my $template = HTML::Template->new(filename => $pperror_template); An earlier instance calling HTML::Template in the same file works fine. The error occurs when try to use it later in the script and causes the same error even when I copy and paste the earlier working code. My guess is that something other than calling the module is causing the error but I'm at a loss as to what to look for. If I remove the code block below, all works OK including the earlier use of Template. Any ideas where to look? Tom ---------- my $template = HTML::Template->new(filename => $pperror_template); $template->param( _pe => $post_error, _wuser => $post_error_wuser, _wemail => $post_error_wemail, ); print "Content-type: text/html\n\n"; print $template->output; |
From: Sven N. <sve...@sv...> - 2007-09-06 08:04:11
|
Hello, this little patch will reveal the parameter name of the tainted value in some cases. I haven't figured out how to do it in the other cases, I don't think the name of the parameter name is preserved in the data structure. Cheers, -Sven diff -u HTML-Template-2.9/Template.pm HTML-Template-2.9.001/Template.pm --- HTML-Template-2.9/Template.pm 2007-01-29 20:32:21.000000000 +0100 +++ HTML-Template-2.9.001/Template.pm 2007-09-06 09:58:16.000000000 +0200 @@ -2567,6 +2567,9 @@ } else { (ref($param_map->{$param}) eq 'HTML::Template::VAR') or croak("HTML::Template::param() : attempt to set parameter '$param' with a scalar - parameter is not a TMPL_VAR!"); + if ($options->{force_untaint} > 1 && tainted($value)) { + croak("HTML::Template::param() : attempt to set parameter '$param' with a tainted value!") + } ${$param_map->{$param}} = $value; } } |
From: Mathew R. <mat...@ne...> - 2007-08-10 04:55:36
|
Hi Chris, I don't think anyone has answered yet... The purpose of a filter is simply to modify the template-text-blob, before being compiled into its internal form, ie: the only thing passed into your filter, is the template. Here is a simple/common filter: my $filter = sub { my $text_ref = shift; my $match = qr/%([-\w\/\.+]+)%/; $$text_ref =~ s/$match/<TMPL_VAR NAME="$1">/g; }; This filter replaces %some_var% with <TMPL_VAR some_var>. Notice that the sub is called with only a text-ref. >From your example below, it looks like you are initialising the sub => ... the result of the function call to initialize_template_header(). What does this function return? for this syntax to work, it will need to return a sub-ref. To answer your last question, you need to make use of "use vars ..." to stash your H::T reference in, eg: { ... use vars qw($HT); $HT = H::T->new(... filter => some_filter ); ... $HT->output(); } sub some_filter { my $textref = shift; use vars qw($HT); ... access $HT ... ... modify $$textref or something... } But I'm not sure why you need to access H::T from within your filter. I suspect that you are trying to something with filters, that it simply wont do -> I might be able to suggest an alternative solution if I know what the problem was. cheers, Mathew Robertson Chris Faust wrote: > > Folks, > > > > I'm having (what I hope is) a syntax problem. > > > > I'm trying to use the "filter" option to run a sub on a template at > create time, but I want the sub in another package and I need to some > other objects with it. > > > > From reading the docs I thought that the HTML::Template object would > simply be the first incoming param, but its not. > > > > For example, here is how I wanted to create my template object: > > > > my $template_header = new HTML::Template(filename => 'CommonHeader.tmpl', > filter => { sub => > scripts::MyPackage->initialize_template_header($r,$db,$site_settings,$user_session_data,\%form_data) > }, > ); > > > > Then in "MyPackage.pm", I would have > > > > sub initialize_template_header { > my > ($self,$template,$r,$db,$site_settings,$user_session_data,$form_data) > = @_; > .... > > } > > > > $self is correctly defined, but $template becomes the first object I > send in ($r in this case). > > > > How do I get the HTML::Template object?? > > > > TIA!! > > -Chris > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ------------------------------------------------------------------------ > > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Chris H. <chr...@bb...> - 2007-08-01 16:53:17
|
Thanks to all for offering suggestions, they've been very useful. Chris On 1 Aug 2007, at 17:22, Philip Tellis wrote: > On 01/08/07, Chris Henden <chr...@bb...> wrote: >> Hi all, >> I'm looking for a nice tutorial on HTML::Template authoring, aimed at >> a client-side developer, without any references to perl techniques >> (or perl references...). > > I have some docs on the java port here: > http://html-tmpl-java.sourceforge.net/howto.shtml > > If you ignore the java code, the HTML code is identical to what you'd > use in any of the other language ports. > > HTH, > > Philip |