Project

General

Profile

TEMPLATE specification » History » Version 8

Version 7 (Werner Klinger, 01/05/2010 09:56 AM) → Version 8/11 (Werner Klinger, 01/05/2010 09:57 AM)

h1. TEMPLATE specification

This is a new specification for a simple template format: raw HTML containing placeholders.

This template specification provides no looping capability. However, using the *part template*, it is possible to repeat a template section.

h2. Full versus part template

h3. Full template

In case of a full template, the template file is a valid HTML file, including HTML, HEAD and BODY directives.

h3. Partial template

Partial template is made of HTML code, excluding any of the HTML, HEAD, BODY directives.

h2. Place holders and reserved keywords

h3. syntax

Placeholders and reserved keywords are delimited within template by '%' (percent) sign surrounding keyword:<pre>Here will the %placeholder% be replaced.</pre>
Werner: Placeholder choice to be discussed here (include your first name when adding comment here).
**



h3. Rules

Placeholders and reserved keywords are made of any characters from within [a-z], [A-Z], [0-9], '-' (dash) and '_' (underscore), and are case intolerant: _ABC_ and _abc_ designate the same placeholder, but _%ABC%_ may not be replaced properly if match is against _%abc%_. Indeed, performing a case insensitive search/replace is resources consuming.

h3. Reserved keywords

Some Placeholders are reserved for futur usage.

* *include*
* do
* loop
* while
* repeat
* break
* exit
* _any string starting with tpl_

h3. Pre-allocated placeholders

Some Placeholders have a predefined role. Sharing this roles amoung templates users is the main purpose of this specification.

* page_title
page title for the TITLE directive
* title
Page main title for the H1 directive
* subtitle
Page subtitle, for wordpress like template (title/subtitle in header)
* content
main page content, usually made of a huge amount of text.
* footer
content for the footer area.
* breadcrumb
Breadcrumb line
* menu
main menu, usually vertical left
* nav
navigation menu, usually horizontal in upper area

h2. Using a template

Using such a template in PHP is as easy as:
<pre>

</pre>