Thread: [htmltmpl] Comments
Brought to you by:
samtregar
From: Robert H. <si...@gm...> - 2007-03-07 16:41:46
|
In TT I can create a comment like: [%# This is a comment %] The benefit to that is that comment gets stripped out when the template is processed (i.e you don't see it if you source the HTML file from the browser window). Is there a way to create a filter in HT that does the same thing? Robert |
From: Michael P. <mp...@pl...> - 2007-03-07 16:46:10
|
Robert Hicks wrote: > In TT I can create a comment like: > > [%# This is a comment %] > > The benefit to that is that comment gets stripped out when the template > is processed (i.e you don't see it if you source the HTML file from the > browser window). > > Is there a way to create a filter in HT that does the same thing? <tmpl_if never_going_to_use_this_var> # This is a comment </tmpl_if> -- Michael Peters Developer Plus Three, LP |
From: Robert H. <si...@gm...> - 2007-03-07 17:41:51
|
Michael Peters wrote: > > Robert Hicks wrote: >> In TT I can create a comment like: >> >> [%# This is a comment %] >> >> The benefit to that is that comment gets stripped out when the template >> is processed (i.e you don't see it if you source the HTML file from the >> browser window). >> >> Is there a way to create a filter in HT that does the same thing? > > <tmpl_if never_going_to_use_this_var> > # This is a comment > </tmpl_if> > Oh, I forget about stuff like that. Robert |
From: Brad C. <bc...@gm...> - 2007-03-07 18:08:00
|
And be sure to specify 'die_on_bad_params' as 0 to use this technique. On Mar 7, 2007, at 9:41 AM, Robert Hicks wrote: > Michael Peters wrote: >> >> Robert Hicks wrote: >>> In TT I can create a comment like: >>> >>> [%# This is a comment %] >>> >>> The benefit to that is that comment gets stripped out when the >>> template >>> is processed (i.e you don't see it if you source the HTML file >>> from the >>> browser window). >>> >>> Is there a way to create a filter in HT that does the same thing? >> >> <tmpl_if never_going_to_use_this_var> >> # This is a comment >> </tmpl_if> >> > Oh, I forget about stuff like that. > > Robert > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Robert H. <si...@gm...> - 2007-03-07 19:45:14
|
Brad Choate wrote: > And be sure to specify 'die_on_bad_params' as 0 to use this technique. > > > On Mar 7, 2007, at 9:41 AM, Robert Hicks wrote: > Surely if it is in <TMPL_IF> you don't need to set that. Robert |
From: Michael P. <mp...@pl...> - 2007-03-07 19:46:49
|
Robert Hicks wrote: > Brad Choate wrote: >> And be sure to specify 'die_on_bad_params' as 0 to use this technique. >> >> On Mar 7, 2007, at 9:41 AM, Robert Hicks wrote: > > Surely if it is in <TMPL_IF> you don't need to set that. You don't need it regardless of tmpl_if or not. die_on_bad_params prevents the Perl code from passing in vars that don't exist in the template, not the template from having unused vars. -- Michael Peters Developer Plus Three, LP |
From: Brad C. <bc...@gm...> - 2007-03-07 20:06:17
|
Ah, cool. Learned something new today. On Mar 7, 2007, at 11:45 AM, Michael Peters wrote: > > > Robert Hicks wrote: >> Brad Choate wrote: >>> And be sure to specify 'die_on_bad_params' as 0 to use this >>> technique. >>> >>> On Mar 7, 2007, at 9:41 AM, Robert Hicks wrote: >> >> Surely if it is in <TMPL_IF> you don't need to set that. > > You don't need it regardless of tmpl_if or not. die_on_bad_params > prevents the > Perl code from passing in vars that don't exist in the template, > not the > template from having unused vars. > > -- > Michael Peters > Developer > Plus Three, LP > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Dan H. <dan...@re...> - 2007-03-07 19:58:01
|
One way is to use H::T filters. You could have something like <rem> and </rem> in your code, and use the filter functionality to remove the tags and enclosed content. There will be a performance hit - it works okay for me but YMMV Dan > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...] On > Behalf Of Robert Hicks > Sent: Thursday, 8 March 2007 5:41 a.m. > To: htm...@li... > Subject: [htmltmpl] Comments > > In TT I can create a comment like: > > [%# This is a comment %] > > The benefit to that is that comment gets stripped out when > the template is processed (i.e you don't see it if you source > the HTML file from the browser window). > > Is there a way to create a filter in HT that does the same thing? > > > Robert > > > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT Join > SourceForge.net's Techsay panel and you'll get the chance to > share your opinions on IT & business topics through brief > surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge &CID=DEVDEV > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: David K. <da...@gi...> - 2007-03-07 20:07:37
|
Hi Dan,=20 Dan Horne <dan...@re...> wrote: > One way is to use H::T filters. You could have something like <rem> > and </rem> in your code, and use the filter functionality to remove > the tags and enclosed content. There will be a performance hit - it > works okay for me but YMMV >=20 > Dan <rem>...? REM?? REM?!?! Your BASIC is showing, Dan! =20 LOL -- Then again, I guess that's less to type than the <tmpl_if = i_am_a_comment> tags that litter my templates :-) -dave |
From: Dan H. <dan...@re...> - 2007-03-07 20:19:00
|
> On Behalf Of David Kaufman > Dan Horne <dan...@re...> wrote: > > One way is to use H::T filters. You could have something like <rem> > > and </rem> in your code, and use the filter functionality to remove > > the tags and enclosed content. There will be a performance hit - it > > works okay for me but YMMV > > > > Dan > > <rem>...? REM?? REM?!?! Your BASIC is showing, Dan! > Ah, I'm getting all misty-eyed thinking about my youth. Long live the TRS-80! As an aside, H::T filters have other great uses. For instance I use [% and %] instead of < and > (e.g. [%rem%] and [%/rem%], and use [%=myvar%], [%IF mycondvar%], [%LOOP myloopvar%] instead of <tmpl_var name="myvar">, <tmpl_if mycondvar>, <tmpl_loop myloopvar>). This means that the editors that our designers prefer don't barf or complain about syntax errors when using HTML-like tag delimiters, and it also means that I don't lose my H::T code in all the HTML tags Dan |
From: Robert H. <si...@gm...> - 2007-03-07 20:36:59
|
Dan Horne wrote: > One way is to use H::T filters. You could have something like <rem> and > </rem> in your code, and use the filter functionality to remove the tags and > enclosed content. There will be a performance hit - it works okay for me but > YMMV > > Dan > sub tmpl_remark { my $text_ref = shift; $$text_ref =~ s|<rem>(\w+)</rem>||gx; } # passed to the template filter => \&tmpl_remark; I did not know you could use a regex in a substitute (or I never thought about doing so). Of course, the regex above is bogus as I am just seeing if that is correct form. Robert |
From: Mathew R. <mat...@ne...> - 2007-03-07 21:46:24
|
Yep, that is the form - although you wont need to 'capture', eg: $$text_ref =~ s|<rem>.*?</rem>||gx; Mathew > sub tmpl_remark { > my $text_ref = shift; > > $$text_ref =~ s|<rem>(\w+)</rem>||gx; > } > > > # passed to the template > > filter => \&tmpl_remark; > > I did not know you could use a regex in a substitute (or I never thought > about doing so). Of course, the regex above is bogus as I am just seeing > if that is correct form. > > |
From: Robert H. <si...@gm...> - 2007-03-07 23:40:27
|
Is there anything funky about using filters with CGI::Application? Robert Mathew Robertson wrote: > Yep, that is the form - although you wont need to 'capture', eg: > > $$text_ref =~ s|<rem>.*?</rem>||gx; > > Mathew >> sub tmpl_remark { >> my $text_ref = shift; >> >> $$text_ref =~ s|<rem>(\w+)</rem>||gx; >> } >> >> >> # passed to the template >> >> filter => \&tmpl_remark; >> >> I did not know you could use a regex in a substitute (or I never thought >> about doing so). Of course, the regex above is bogus as I am just seeing >> if that is correct form. >> >> > |
From: Mathew R. <mat...@ne...> - 2007-03-07 21:43:25
|
There is a performance hit, but only at template-parse time. ie: if you use caching there is no performance hit. Mathew Dan Horne wrote: > One way is to use H::T filters. You could have something like <rem> and > </rem> in your code, and use the filter functionality to remove the tags and > enclosed content. There will be a performance hit - it works okay for me but > YMMV > > Dan > > >> -----Original Message----- >> From: htm...@li... >> [mailto:htm...@li...] On >> Behalf Of Robert Hicks >> Sent: Thursday, 8 March 2007 5:41 a.m. >> To: htm...@li... >> Subject: [htmltmpl] Comments >> >> In TT I can create a comment like: >> >> [%# This is a comment %] >> >> The benefit to that is that comment gets stripped out when >> the template is processed (i.e you don't see it if you source >> the HTML file from the browser window). >> >> Is there a way to create a filter in HT that does the same thing? >> >> >> Robert >> >> >> -------------------------------------------------------------- >> ----------- >> Take Surveys. Earn Cash. Influence the Future of IT Join >> SourceForge.net's Techsay panel and you'll get the chance to >> share your opinions on IT & business topics through brief >> surveys-and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge >> > &CID=DEVDEV > >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users >> >> > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |