Re: TMPL_SET -- this would be nice to have.
"Aleksandar Petrovic" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Organization | Techcode.NET |
| Message-ID | <[email protected]> |
> 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) Already answered - yes.
2) Not sure ...
3) Here it is:
<html>
<head>
<title> Whatever </title>
</head>
<body>
<TMPL_INCLUDE NAME="_header.tmpl">
....
<TMPL_INCLUDE NAME="_footer.tmpl">
Anyway, I walked the similar path when I needed some things added to the
HTML-Template
and many sugested TemplateToolkit ...
--
Aleksandar Petrović
Webmaster of Techcode.NET
Web: http://www.techcode.net
Skype: techcode.net
Yahoo: johndoeyu
ICQ: 75863829
MSN: [email protected]
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642