]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - doc/THEMES
Activated Id substitution for Subversion
[SourceForge/phpwiki.git] / doc / THEMES
1 ! Brief Example of Creating Your Own Theme
2
3 To create or modify one of the existing themes:
4 * Make a copy of one of the themes.
5 * Look through the default theme, and for any of those templates you
6   want to modify, duplicate them in your new theme folder with the
7   same directory structure and modify them there instead of the
8   originals.
9 * Fix the name in themeinfo.php:
10   $Theme = new Theme('NewName');
11 * or if you have to override some default Theme methods
12   class Theme_NewName extends Theme;
13   ...
14   $Theme = new Theme_NewName('NewName');
15
16
17 Note:
18 If you base your theme on the default theme instead of one of the
19 others, you can safely delete any files you DID NOT modify from the
20 original (so long as you keep the default theme!).
21
22 Review the themeinfo.php for any necessary changes, and add the name
23 of your theme to index.php.
24   define('THEME','NewName');
25
26 ! Template Structure
27
28 Templates currently must use the .tmpl extension (simple PHP parsed files).
29 Other file extensions are reserved for future use (i.e. .tpl for Smarty or 
30 .html for our old template expansion.)
31
32 Only one template is called, ususally the "html.tmpl" template, 
33 which includes all other templates then.
34
35 Theme templates are regular xhtml, but the php parts within "<?" and "?>" 
36 are treated especially by phpwiki. HTML entities within the php parts 
37 should be created by our HtmlElement methods, which create well-formed 
38 HTML objects. 
39 Pure HTML entities, e.g. <? echo "<br>" ?> will be escaped to &lt;br&gt;.
40
41 You can easily embed other templates by your own, e.g. <?= Template('body') ?>
42
43 Templates are used
44 * by the master action (html and htmldump), which include most other 
45   plugins in a hierarchical manner, 
46 * by certain actions (editpage) or plugins (e.g. info, userprefs, 
47   addcomment, ...) or 
48 * by certain pagetypes (e.g. wikiblog, comment, wikiforum)
49
50 To include templates from other themes use this syntax:
51   <?= Template('default/search') ?>
52 includes the search template from the default theme.
53
54 Warning!
55 When you write your own templates or change existing ones, you might 
56 easily destroy XHTML validity of the generated pages. By using 
57 the various HTML() methods within a plugin's php code it is guaranteed 
58 to produce validating XHTML, by using custom templates not.
59
60 ----
61 PhpWikiDocumentation