Nested Templates

From KallestadWiki

Revision as of 06:43, 4 June 2007; NevetS (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Jump to: navigation, search

Contents

Overview

Template Nesting Capabilities are one of the KDF foundational elements.

HTML::Template

HTML::Template is a CPAN module that does a fantastic job of separating coding elements from the templating system. There are a great many templating systems out there, but for the most part, adding power to the templating system inherently makes template syntax unnecessarily complex. That complexity makes a difficult transition for anybody wishing to adopt it - making the most out of the given templating system requires learning the philosophy and syntax behind that templating system.

While there have been a few additional modules that add syntactical functionality to HTML::Template, that is not the direction for KDF. KDF wants the basic functionality of value replacement and the simplicity of syntax. This basic requirement will ensure that KDF adoption rates are strong and the simplicity of the framework remains intact. For power users, I may make more robust templating systems optional, but that inherently implies platform dependency - which is another thing that I want KDF to avoid.

Layered Presentation

In conceptualizing KDF output capabilities I see a need for layered presentation - meaning that elements on a given page container need to be able to utilize re-usable sub-templates as part of the presentation definition.

Take the following example. We aren't simply concerned with variable replacement - we have sub-templates that can be re-used in a variety of scenarios.

The master template defines the page. The content area can be arbitrarily defined. 1 of 2 examples - an article template can be used to populate the master templates content area 2 of 2 examples - an article listing template can be used to show a group of articles The summary listings can be made up of sub-templates as well - an example sub-template definition
A Master Page Template
Enlarge
A Master Page Template
An article template
Enlarge
An article template
An article listing Template
Enlarge
An article listing Template
article listing details
Enlarge
article listing details

Nesting Templates using the HTML Template model implies file system-based templates, which is contrary to the desired KDF featureset. At this point, I'm contemplating either a re-write of HTML Template functionality - limiting KDF to support of just the basic HTML::Template features and the desired KDF functionality or utilizing HTML::Template filters to implement additonal template tags for nested template management. That technical aspect is neither here nor there. The syntax for nesting templates is as follows:

 <KDFInclude NAME="template_name">

Template includes are expanded prior to output, so templates will behave as if they were included in the original template file.

Kallestad Development Framework Topics

Personal tools