html-template-users Mailing List for HTML::Template (Page 13)
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: Jason P. <ja...@jo...> - 2007-04-03 02:10:26
|
How about a new tag, either as part of the standard distribution or a plugin: TMPL_VIRTUAL The one thing that I like when I'm doing PHP pages is that I can build singular dynamic components and simply include them from the parent template. i.e. # FILE: index.php <? virtual( 'helloworld.php' ); ?> # FILE: helloworld.php <? print "Hello World!"; ?> Yes, I know about Philipp's Widgets articles[1] on perl.com, but you still need to put the encapsulation logic in your code, which seems redundant. How about if the HTML_VIRTUAL called LWP to request the URL and replace the tag w/ the response's content? # FILE: index.TMPL <!-- TMPL_VIRTUAL URL="helloworld.php" --> # FILE: helloworld.php <? print "Hello World!"; ?> - Jason [1]: http://www.perl.com/pub/a/2007/02/02/htmltemplate-widgets.html |
From: Matt T. <mt...@as...> - 2007-04-02 14:40:15
|
Thanks for the quick reply. This question may be beyond the scope of this mailing list, but... I am pulling data from a database view that adds spaces to create alignment. For example: * AZ300~30ST Full-Width Std Thic AZ300~18ST Full-Width Std Thic * AZ360HD~36HD 20in Tandem St AZ360HD~20HD 20in Tandem St AZ360HD~24Z 20in Tandem St I am replacing the leading spaces before writing the data to a select box's option tag. I tried adding style="white-space: pre;" to the option tag, but that made all the new line characters show up. I tried putting a div tag, with style="white-space: pre;" around the contents of the option tag. That didn't have any effect. <select name="partid"> <option value="AZ300R2F3S2"> <div style="white-space: pre;">* AZ300~30ST Full-Width Std Thic (AZ300R2F3S2)</div> </option> <option value="X000564"> <div style="white-space: pre;"> AZ300~18ST Full-Width Std Thic (X000564)</div> </option> </select> I am sure there are other solutions, but is the first thing that came to mind. Matt On Fri, 2007-03-30 at 18:22 -0400, Sam Tregar wrote: > On Fri, 30 Mar 2007, Matt Taylor wrote: > > > I couldn't find this information in the archive... > > > > I like the ESCAPE options (HTML, URL, JS). > > > > Is there a way to also escape whitespace? In particular, I would like > > an easier way to replace spaces with > > > > Currently looping through data from dbi and replacing. Any ideas? > > Don't do that? really shouldn't be needed in modern HTML > layout. Maybe you can show us what you're using it for and we can > suggest a better way? > > -sam |
From: Mathew R. <mat...@ne...> - 2007-04-01 23:01:32
|
>> I couldn't find this information in the archive... >> >> I like the ESCAPE options (HTML, URL, JS). >> >> Is there a way to also escape whitespace? In particular, I would like >> an easier way to replace spaces with >> >> Currently looping through data from dbi and replacing. Any ideas? >> > > Don't do that? really shouldn't be needed in modern HTML > layout. Maybe you can show us what you're using it for and we can > suggest a better way? > Hi Sam, One of the mods that I made to my local copy of H::T was to allow the ESCAPE modules to be dynamically loadable so that users could implement escaping according to whatever rules they had. Would you be interested in a patch to allow this feature? Mathew |
From: Sam T. <sa...@tr...> - 2007-03-30 22:22:06
|
On Fri, 30 Mar 2007, Matt Taylor wrote: > I couldn't find this information in the archive... > > I like the ESCAPE options (HTML, URL, JS). > > Is there a way to also escape whitespace? In particular, I would like > an easier way to replace spaces with > > Currently looping through data from dbi and replacing. Any ideas? Don't do that? really shouldn't be needed in modern HTML layout. Maybe you can show us what you're using it for and we can suggest a better way? -sam |
From: Matt T. <mt...@as...> - 2007-03-30 16:41:03
|
I couldn't find this information in the archive... I like the ESCAPE options (HTML, URL, JS). Is there a way to also escape whitespace? In particular, I would like an easier way to replace spaces with Currently looping through data from dbi and replacing. Any ideas? Matt |
From: Mathew R. <mat...@ne...> - 2007-03-26 01:39:55
|
>> As an aside, there are a number of different techniques used to get >> the UTF8 strings into the templates, eg: TMPL_VAR's, hacks to H::T, >> using H::T::E with a callback. > > Why would you need a hack to get UTF8 strings into the templates? Is > there a bug I should be fixing here? ahh - my bad - I should have been *much* more clear about what I was talking about. Often the requirement for needing UTF8 is to be able to translate a website into multiple languages, while using the existing templates. One problem with this is that the static text within the template is that it wont be translated into the target language. One solution is simply to get the template translated - however this means that each time the sites' layout changes, the new templates need to be translated again. An alternate solution is to store the static text within the application, then use TMPL_VAR's to output the text - thus allowing lookup of the static, into the target language. Mathew |
From: Sam T. <sa...@tr...> - 2007-03-22 04:19:07
|
On Wed, 21 Mar 2007, Mathew Robertson wrote: > As an aside, there are a number of different techniques used to get > the UTF8 strings into the templates, eg: TMPL_VAR's, hacks to H::T, > using H::T::E with a callback. Why would you need a hack to get UTF8 strings into the templates? Is there a bug I should be fixing here? -sam |
From: Mathew R. <mat...@ne...> - 2007-03-21 00:20:46
|
I worked on a product which was translated into 6 languages; we supplied templates in ASCII and used TMPL_VAR's to output the appropriate UTF8-encoded string. ie: there are no real problems if your templates are just layouts and the content is provided by TMPL_VAR's. As an aside, there are a number of different techniques used to get the UTF8 strings into the templates, eg: TMPL_VAR's, hacks to H::T, using H::T::E with a callback. Mathew H. Tan-Tenn wrote: > Having read > > "how to use UTF8?": > http://www.arcknowledge.com/gmane.comp.lang.perl.modules.html-template/2004-07/msg00008.html > > the reformist "templates in UTF-8 (and generic support for PerlIO layers)": > http://www.arcknowledge.com/gmane.comp.lang.perl.modules.html-template/2003-06/msg00011.html > > and the pessimistic "No way to deal with multi-bytes characters": > http://rt.cpan.org/Public/Bug/Display.html?id=18910 > > I am curious to learn what is the current best practice for those of us > desperately dependent on UTF-8 (in my case Unicode is required to > display my languages). > > Thanks. > > > > ------------------------------------------------------------------------- > 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: H. Tan-T. <sha...@lo...> - 2007-03-20 06:23:38
|
Having read "how to use UTF8?": http://www.arcknowledge.com/gmane.comp.lang.perl.modules.html-template/2004-07/msg00008.html the reformist "templates in UTF-8 (and generic support for PerlIO layers)": http://www.arcknowledge.com/gmane.comp.lang.perl.modules.html-template/2003-06/msg00011.html and the pessimistic "No way to deal with multi-bytes characters": http://rt.cpan.org/Public/Bug/Display.html?id=18910 I am curious to learn what is the current best practice for those of us desperately dependent on UTF-8 (in my case Unicode is required to display my languages). Thanks. |
From: Roger B. W. <ro...@fi...> - 2007-03-16 19:46:26
|
On Fri, Mar 16, 2007 at 03:07:57PM -0400, C Hagstrom wrote: >I'm not that savvy of an HTML::Template user .... and I thought >that variables were typically available for use in included templates without >the use of "::Set".... maybe I'm missing something? Or maybe I'm just >flat out wrong? I don't think the DEFAULT= parameter to TMPL_VAR was available when I wrote ::Set. In any case, to set a variable and not output it immediately, one would have to wrap the statement: <TMPL_IF NAME=never><TMPL_VAR NAME=title DEFAULT=Page Title></TMPL_IF> which seems a lot more trouble than <TMPL_SET NAME=title VALUE=Page title> Also, if you set a value with DEFAULT=, you can't query it programmatically via $template->param(). R |
From: C H. <hag...@ep...> - 2007-03-16 19:05:30
|
I'm not that savvy of an HTML::Template user .... and I thought that variables were typically available for use in included templates without the use of "::Set".... maybe I'm missing something? Or maybe I'm just flat out wrong? Carl >What I did for bailii.org (and various other sites based on that code) >is a very simple approach: every page does a <tmpl_include> of the "top" >and "bottom" templates, which wrap the page-specific content. Using my >HTML::Template::Set module extension, the page template can then pass >variables to the included templates (such as the page's title). >More information if it's wanted. >Roger C. Hagstrom hag...@ep... |
From: Alex K. <ka...@ra...> - 2007-03-16 14:31:10
|
Patch to enable "ESCAPE=WML" in HTML::Template::JIT. -- Alex Kapranoff, $n=["1another7Perl213Just3hacker49"=~/\d|\D*/g]; $$n[0]={grep/\d/,@$n};print"@$n{1..4}\n" |
From: Alex K. <ka...@ra...> - 2007-03-16 14:21:45
|
Good day! We serve lots of WAP pages with HTML::Template. So this is my old WML patch updated for 2.9 in case anyone is interested. It's small, includes tests and docs so I still hope it will be included in base some day :) -- Alex Kapranoff, $n=["1another7Perl213Just3hacker49"=~/\d|\D*/g]; $$n[0]={grep/\d/,@$n};print"@$n{1..4}\n" |
From: Rudolph F. <rud...@gm...> - 2007-03-11 09:30:47
|
On 3/10/07, Roger Burton West <ro...@fi...> wrote: > What I did for bailii.org (and various other sites based on that code) > is a very simple approach: every page does a <tmpl_include> of the "top" > and "bottom" templates, which wrap the page-specific content. Using my > HTML::Template::Set module extension, the page template can then pass > variables to the included templates (such as the page's title). > > More information if it's wanted. > > Roger Thanks for the tip! Rudolph |
From: Roger B. W. <ro...@fi...> - 2007-03-10 21:52:18
|
On Sat, Mar 10, 2007 at 04:38:26PM +0100, Rudolph Froger wrote: >I'm new on this list. I've a question on using HTML::Template for a >larger project: >- I will use a base template which defines the basic structure of the site. >- Different parts of the template will have dynamic content (generated >by the scripts). What I did for bailii.org (and various other sites based on that code) is a very simple approach: every page does a <tmpl_include> of the "top" and "bottom" templates, which wrap the page-specific content. Using my HTML::Template::Set module extension, the page template can then pass variables to the included templates (such as the page's title). More information if it's wanted. Roger |
From: Robert H. <si...@gm...> - 2007-03-10 17:40:29
|
Rudolph Froger wrote: > Hi, > > I'm new on this list. I've a question on using HTML::Template for a > larger project: > - I will use a base template which defines the basic structure of the site. > - Different parts of the template will have dynamic content (generated > by the scripts). > What 'd like to do is create the base template and then create > seperate subtemplates (one per page). Every sub template only defines > the dynamic parts of the page. This sub template should then inherit > the base template to fill these parts. > > What is the recommended approuch and/or best practice for such a setup? > http://www.perl.com/pub/a/2007/02/02/htmltemplate-widgets.html http://www.perl.com/pub/a/2006/11/30/html-template-filters.html Both of those should give you some ideas. HTH, Robert |
From: Rudolph F. <rud...@gm...> - 2007-03-10 15:38:31
|
Hi, I'm new on this list. I've a question on using HTML::Template for a larger project: - I will use a base template which defines the basic structure of the site. - Different parts of the template will have dynamic content (generated by the scripts). What 'd like to do is create the base template and then create seperate subtemplates (one per page). Every sub template only defines the dynamic parts of the page. This sub template should then inherit the base template to fill these parts. What is the recommended approuch and/or best practice for such a setup? Regards, Rudolph |
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: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: 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 > |
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: 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: 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: 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 > |