TEMPLATE specification » History » Version 6
« Previous -
Version 6/11
(diff) -
Next » -
Current version
Werner Klinger, 01/05/2010 09:56 AM
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.
Full versus part template¶
Full template¶
In case of a full template, the template file is a valid HTML file, including HTML, HEAD and BODY directives.
Partial template¶
Partial template is made of HTML code, excluding any of the HTML, HEAD, BODY directives.
Place holders and reserved keywords¶
syntax¶
Placeholders and reserved keywords are delimited within template by '%' (percent) sign surrounding keyword:
Here will the %placeholder% be replaced.
Werner: Placeholder choice to be discussed here (include your first name).
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.
Reserved keywords¶
Some Placeholders are reserved for futur usage.
- include
- do
- loop
- while
- repeat
- break
- exit
- any string starting with tpl
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
Using a template¶
Using such a template in PHP is as easy as: