plainblack.com
Username Password
search
Bookmark and Share
Subscribe

Nested Templates

This is from the forum hopefully it will help someone:

option 1 use HTMLTemplating system:

I want to have 3 or 4 similar templates that each will have common elements... it would be good to be able to centrallize the common elements to a separate template file that can then be included in the the 3 or 4 similar templates.

You should be able to use <tmpl_include>, however it is disabled by default.

In WebGUI/lib/WebGUI/Asset/Template/HTMLTemplate.pm, there's a line that reads:

no_includes=>1,

which disallows the use of included templates.

Usage:

<TMPL_INCLUDE NAME="filename.tmpl">

using the full system path

NOTE: the tmpl_include tag includes templates from file space, not from the WebGUI Template Asset.

More information on this: http://search.cpan.org/~samtregar/HTML-Template-2.9/Template.pm#TMPL_INCLUDE

option 2

This will only work if the snippets don't have template variables in them.

If you want common code in multiple templates, try using a Snippet Asset, and then use the AssetProxy macro to bring it into each template.  It's success will depend on the order that WebGUI handles macros and templates.

If macros get processed first, then it would be fine.  If templates get processed first, then it wouldn't work.  You'll need to try it.

Keywords: templates

Search | Most Popular | Recent Changes | Wiki Home
© 2018 Plain Black Corporation | All Rights Reserved