Re: [htmltmpl-java] tmpl_include
Status: Beta
Brought to you by:
bluesmoon
From: Philip S T. <phi...@gm...> - 2003-01-27 18:32:53
|
Sometime Today, Thomas Wabner assembled some asciibets to say: > I will use the <tmpl_include> tag to include many html fragments in my > whole html-site. The feature request is the following: > > i will try this code in html: > > <tmpl_include <tmpl_var body1> > > > but this does not work at the moment (i know why, it is not yet > implemented ;-). well, it can't be implemented because tmpl_include is processed much before the variables are handled. basically, when the template is being read, all tmpl_includes are read in and inserted at the relevant positions. It's only after all this has happened that tmpl_vars are processed. furthermore, adding this feature will break compatibility with the HTML::Template perl module. It can be done with a Filter, when that's done. I'm still working on it. > I use html-java-templates in a servlet environment. So to install the > servlet on many plattform i have a config file for the servlet > environment. In this config file i will tell the servlet global > include html-templates (these templates will also have tmpl_vars). So > when i move the servlet i must never update all my global templates to > change the path to these html-templates. I must only change the config > and the rest goes dynamicly. you can do this with the path and search_path_on_include parameters to the constructor. Since this is done programmatically, you can have the path read from a configuration file. This is the way I do it. All include templates will be in a static location. Just include that path in the path variable, and specify only the template filename in the tmpl_include, and not the full path. eg: global_templates/ include_1.tmpl include_2.tmpl local_files/ main1.tmpl main2.tmpl main1.tmpl: <tmpl_include file="include_1.tmpl"> main1.java: set path to /path/to/local_files, /path/to/global_templates set search_path_on_include to true initialise template Philip |