Project

General

Profile

TEMPLATE specification » History » Version 5

Werner Klinger, 01/05/2010 09:55 AM

1 1 Redmine Admin
h1. TEMPLATE specification
2 1 Redmine Admin
3 1 Redmine Admin
This is a new specification for a simple template format: raw HTML containing placeholders.
4 1 Redmine Admin
5 2 Redmine Admin
This template specification provides no looping capability. However, using the *part template*, it is possible to repeat a template section.
6 1 Redmine Admin
7 1 Redmine Admin
h2. Full versus part template
8 1 Redmine Admin
9 1 Redmine Admin
h3. Full template
10 1 Redmine Admin
11 1 Redmine Admin
In case of a full template, the template file is a valid HTML file, including HTML, HEAD and BODY directives.
12 1 Redmine Admin
13 1 Redmine Admin
h3. Partial template
14 1 Redmine Admin
15 1 Redmine Admin
Partial template is made of HTML code, excluding any of the HTML, HEAD, BODY directives.
16 1 Redmine Admin
17 1 Redmine Admin
h2. Place holders and reserved keywords
18 1 Redmine Admin
19 1 Redmine Admin
h3. syntax
20 1 Redmine Admin
21 1 Redmine Admin
Placeholders and reserved keywords are delimited within template by '%' (percent) sign surrounding keyword:<pre>Here will the %placeholder% be replaced.</pre>
22 1 Redmine Admin
+(to be discussed)+
23 1 Redmine Admin
24 1 Redmine Admin
h3. Rules
25 1 Redmine Admin
26 5 Werner Klinger
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.
27 1 Redmine Admin
28 1 Redmine Admin
h3. Reserved keywords
29 1 Redmine Admin
30 1 Redmine Admin
Some Placeholders are reserved for futur usage.
31 1 Redmine Admin
32 2 Redmine Admin
* *include*
33 1 Redmine Admin
* do
34 1 Redmine Admin
* loop
35 1 Redmine Admin
* while
36 1 Redmine Admin
* repeat
37 1 Redmine Admin
* break
38 1 Redmine Admin
* exit
39 3 Werner Klinger
* _any string starting with tpl_
40 3 Werner Klinger
41 3 Werner Klinger
h3. Pre-allocated placeholders
42 3 Werner Klinger
43 3 Werner Klinger
Some Placeholders have a predefined role. Sharing this roles amoung templates users is the main purpose of this specification.
44 3 Werner Klinger
45 3 Werner Klinger
* page_title
46 3 Werner Klinger
  page title for the TITLE directive
47 3 Werner Klinger
* title
48 3 Werner Klinger
  Page main title for the H1 directive
49 3 Werner Klinger
* subtitle
50 3 Werner Klinger
  Page subtitle, for wordpress like template (title/subtitle in header)
51 3 Werner Klinger
* content
52 3 Werner Klinger
  main page content, usually made of a huge amount of text.
53 3 Werner Klinger
* footer
54 3 Werner Klinger
  content for the footer area.
55 3 Werner Klinger
* breadcrumb
56 3 Werner Klinger
  Breadcrumb line
57 4 Werner Klinger
* menu
58 4 Werner Klinger
  main menu, usually vertical left
59 4 Werner Klinger
* nav
60 4 Werner Klinger
  navigation menu, usually horizontal in upper area
61 2 Redmine Admin
62 2 Redmine Admin
h2. Using a template
63 2 Redmine Admin
64 2 Redmine Admin
Using such a template in PHP is as easy as:
65 2 Redmine Admin
<pre>
66 2 Redmine Admin
67 2 Redmine Admin
</pre>