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