Re: Passing variable to included template?

Dmitri Tikhonov <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
This has already been discussed, most recently here:

http://sourceforge.net/mailarchive/forum.php?thread_id=10395329&forum_id=9830

  - Dmitri.

On Thu, 2006-07-20 at 21:33 +0200, Bas A. Schulte wrote:
> Hi all,
> 
> I've been using H::T for some time for simple stuff but I'm using it  
> for something more complicated now. What I'd like to do is have one  
> site-wide header template that gets included from individual pages  
> receive a variable from the individual page's template.
> 
> Something like:
> 
> site-wide.tmpl:
> 
> <table>
> 	<tr>
> 		<td>(Title of subpage)</td>
> 	</tr>
>          ....
> </table>
> 
> Then individual pages have this:
> 
> <html>
> 	<body>
> 		<TMPL_INCLUDE NAME="header.tmpl">
> 
> 		...
> 	</body>
> </html>
> 
> Now what I'd like to do is set a variable in the individual page  
> containing the "nice" title of the page. I don't want to set that  
> name from code (it's a generic handler that basically calls H::T->new  
> and sticks in some user properties. Ideally, I'd like to be able to  
> set a variable in the individual page and do this in site-wide.tmpl:
> 
> <table>
> 	<tr>
> 		<td><TMPL_VAR NAME="title"></td>
> 	</tr>
>          ....
> </table>
> 
> And set the value for "title" in the individual page's template:
> 
> <html>
> 	<body>
>                  <TMPL_SET_VAR title="abc">
> 		<TMPL_INCLUDE NAME="header.tmpl">
> 
> 		...
> 	</body>
> </html>
> 
>  From the perldoc, I can't find it and searching the mailing list  
> won't work ("Unable to contact search server" etc.). A quick browse  
> did reveal some info but not quite something as simple as I need now :)
> 
> Thanks,
> 
> Bas.
> 
> 
> -------------------------------------------------------------------------
> 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
> [email protected]
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.