Go to content Go to blog navigation Go to link heaven

Templation

Recent Updates

Recent Articles

Search

RSS feed Atom feed

Nested Templates

2005.10.12 12:22

Templation has always been able to nest templates -- indirectly. Widgets have the ability to call templates, therefore it's a simple matter to write a widget that can include a sub-template. The sub-template can be specified either through meta tags or as a parameter to the widget tag in the template.

After careful consideration I've decided to make this a core feature, and add a special template tag just for the purpose. Much like <%%inc filename.php%%> is shorthand for the tpl_include.php widget, I'll be introducting a new tag:

<%%tpl filename.php%%>

This will be shorthand for a tpl_template.php widget. In the past widgets and templates could be nested in alternating fashion. That is, a template could include a widget could include a template ad infinitum. However, in the new paradigm templates can include sub-templates directly, and widgets can include sub-widgets directly (via the method Template_Widget::subWidget()).

Comments