Thread: [htmltmpl] TMPL_SET -- this would be nice to have.
Brought to you by:
samtregar
From: Dmitri T. <dti...@vo...> - 2006-05-17 12:50:49
|
Dear List, In most of my templates, I have a header and a footer templates that get included from the main template, which I assume is a very common scenario. My problem is that <title> tag is in the header template and it needs to change for each template. There are two approaches that I can currently use: 1. Put <title> tag into main template. This works, but I do not believe having <title> outside of <head> is correct HTML[1]. 2. Set title from CGI script. This is not very convenient and, in my mind, breaks the paradigm. The best solution, in my mind, would be something like this: ---- template search_results.tmpl ---- <TMPL_SET NAME='TITLE' VALUE='Search Results'> <!-- this is where title is used --> <TMPL_INCLUDE NAME="_header.tmpl"> <some_html_here> <TMPL_INCLUDE NAME="_footer.tmpl"> ---- end of template ---- Questions: 1. Is this feasible to implement? 2. Is such feature compatible with HTML::Template philosophy? 3. (Bonus question) is there another approach besides the two above that I can use right now? Thank you, - Dmitri. 1. http://www.w3.org/TR/html401/struct/global.html#h-7.4.2 |
From: Roger B. W. <ro...@fi...> - 2006-05-17 12:54:22
|
On Wed, May 17, 2006 at 08:51:02AM -0400, Dmitri Tikhonov wrote: >1. Is this feasible to implement? I have done that very thing in my HTML::Template::Set extension module. Copy on request. Roger |
From: Dmitri T. <dti...@vo...> - 2006-05-17 13:00:40
|
On Wed, 2006-05-17 at 08:54 -0400, Roger Burton West wrote: > On Wed, May 17, 2006 at 08:51:02AM -0400, Dmitri Tikhonov wrote: > > >1. Is this feasible to implement? > > I have done that very thing in my HTML::Template::Set extension > module. Oh, this is very neat. Is this it (confused by author name): http://search.cpan.org/~djr/HTML-Template-Set-1.009/Set.pm Maybe we can get Sam to integrate it into HTML::Template proper? > Copy on request. Not sure what you mean by that... - Dmitri. |
From: Philip T. <phi...@gm...> - 2006-05-17 13:10:16
|
Sometime Today, DT cobbled together some glyphs to say: > Maybe we can get Sam to integrate it into HTML::Template proper? Not going to happen. read list archives and documentation for why. -- God made everything out of nothing, but the nothingness shows through. -- Paul Valery |
From: Roger B. W. <ro...@fi...> - 2006-05-17 13:20:47
|
On Wed, May 17, 2006 at 09:00:53AM -0400, Dmitri Tikhonov wrote: >Oh, this is very neat. Is this it (confused by author name): >http://search.cpan.org/~djr/HTML-Template-Set-1.009/Set.pm No - mine predates that, but I didn't upload it to CPAN because while it is good enough for my use I don't think it's good enough for general distribution. >Maybe we can get Sam to integrate it into HTML::Template proper? That won't happen. >> Copy on request. >Not sure what you mean by that... If you would like a copy - it's very small, 689 bytes - let me know and I'll send it to you directly. Roger |
From: Aleksandar P. <web...@te...> - 2006-05-18 09:38:04
|
> Dear List, > > In most of my templates, I have a header and a footer templates that ge= t > included from the main template, which I assume is a very common > scenario. My problem is that <title> tag is in the header template and > it needs to change for each template. There are two approaches that I > can currently use: > > 1. Put <title> tag into main template. This works, but I do not believ= e > having <title> outside of <head> is correct HTML[1]. > > 2. Set title from CGI script. This is not very convenient and, in my > mind, breaks the paradigm. > > The best solution, in my mind, would be something like this: > > ---- template search_results.tmpl ---- > <TMPL_SET NAME=3D'TITLE' VALUE=3D'Search Results'> > <!-- this is where title is used --> > <TMPL_INCLUDE NAME=3D"_header.tmpl"> > <some_html_here> > <TMPL_INCLUDE NAME=3D"_footer.tmpl"> > ---- end of template ---- > > Questions: > > 1. Is this feasible to implement? > 2. Is such feature compatible with HTML::Template philosophy? > 3. (Bonus question) is there another approach besides the two above tha= t > I can use right now? > > Thank you, > > - Dmitri. 1) Already answered - yes. 2) Not sure ... 3) Here it is: <html> <head> <title> Whatever </title> </head> <body> <TMPL_INCLUDE NAME=3D"_header.tmpl"> .... <TMPL_INCLUDE NAME=3D"_footer.tmpl"> Anyway, I walked the similar path when I needed some things added to the = =20 HTML-Template and many sugested TemplateToolkit ... --=20 Aleksandar Petrovi=C4=87 Webmaster of Techcode.NET Web: http://www.techcode.net Skype: techcode.net Yahoo: johndoeyu ICQ: 75863829 MSN: joh...@ya... |