Project

General

Profile

TEMPLATE specification » History » Version 10

Werner Klinger, 01/05/2010 09:57 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 7 Werner Klinger
Werner: Placeholder choice to be discussed here (include your first name when adding comment here).
23 10 Werner Klinger
24 1 Redmine Admin
25 1 Redmine Admin
h3. Rules
26 1 Redmine Admin
27 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.
28 1 Redmine Admin
29 1 Redmine Admin
h3. Reserved keywords
30 1 Redmine Admin
31 1 Redmine Admin
Some Placeholders are reserved for futur usage.
32 1 Redmine Admin
33 2 Redmine Admin
* *include*
34 1 Redmine Admin
* do
35 1 Redmine Admin
* loop
36 1 Redmine Admin
* while
37 1 Redmine Admin
* repeat
38 1 Redmine Admin
* break
39 1 Redmine Admin
* exit
40 3 Werner Klinger
* _any string starting with tpl_
41 3 Werner Klinger
42 3 Werner Klinger
h3. Pre-allocated placeholders
43 3 Werner Klinger
44 3 Werner Klinger
Some Placeholders have a predefined role. Sharing this roles amoung templates users is the main purpose of this specification.
45 3 Werner Klinger
46 3 Werner Klinger
* page_title
47 3 Werner Klinger
  page title for the TITLE directive
48 3 Werner Klinger
* title
49 3 Werner Klinger
  Page main title for the H1 directive
50 3 Werner Klinger
* subtitle
51 3 Werner Klinger
  Page subtitle, for wordpress like template (title/subtitle in header)
52 3 Werner Klinger
* content
53 3 Werner Klinger
  main page content, usually made of a huge amount of text.
54 3 Werner Klinger
* footer
55 3 Werner Klinger
  content for the footer area.
56 3 Werner Klinger
* breadcrumb
57 3 Werner Klinger
  Breadcrumb line
58 4 Werner Klinger
* menu
59 4 Werner Klinger
  main menu, usually vertical left
60 4 Werner Klinger
* nav
61 4 Werner Klinger
  navigation menu, usually horizontal in upper area
62 2 Redmine Admin
63 2 Redmine Admin
h2. Using a template
64 2 Redmine Admin
65 2 Redmine Admin
Using such a template in PHP is as easy as:
66 2 Redmine Admin
<pre>
67 2 Redmine Admin
68 2 Redmine Admin
</pre>