devel:templates
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
devel:templates [2011-03-12 08:23] – 71.183.122.50 | devel:templates [2023-09-24 01:08] (current) – Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== DokuWiki Template Development ====== | ====== DokuWiki Template Development ====== | ||
- | You can customize the design of [[: | + | You can customize the design of [[: |
===== Getting Started ===== | ===== Getting Started ===== | ||
- | The easiest way to create a new template is by taking an already existing one as starting point. It's a good idea to use the default template because it is clean and follows the DokuWiki template standards. Template names (directories) have to be lowercase, and " | ||
- | | + | The easiest way to create a new template is by taking an already existing one as starting point. It's a good idea to use the starter template because it is clean and follows the DokuWiki template standards. |
+ | |||
+ | - Install the [[template: | ||
+ | | ||
- Select the new template in the configuration manager | - Select the new template in the configuration manager | ||
- | - Then have a look at the template files (see [[#Directory Layout]]) | + | - Then change your template to your heart' |
- | - Have a look on how [[:DokuWiki]] handles | + | - When your template is ready, consider |
- | | + | |
+ | === Template naming conventions === | ||
+ | |||
+ | A valid template name (directory): | ||
+ | * Should only contain the characters a-z and 0-9. | ||
+ | * Dot '' | ||
+ | * DokuWiki' | ||
+ | * Using underscore will also give a [[:popularity|popularity]] rating of zero. | ||
+ | | ||
+ | * If the same name is used by two different templates | ||
+ | * they are mutually exclusive and inherent incompatible, | ||
+ | * furthermore only one of them can have a template homepage on [[: | ||
+ | |||
+ | **It is important | ||
===== Directory Layout ===== | ===== Directory Layout ===== | ||
- | The templates | + | |
+ | Templates | ||
+ | |||
+ | CSS files are specified in the '' | ||
* ''< | * ''< | ||
- | * ''< | + | * ''< |
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
* '' | * '' | ||
- | * ''< | + | * ''< |
- | * ''< | + | * ''< |
- | * '' | + | * '' |
+ | * '' | ||
+ | * '' | ||
- | ===== Functions ===== | + | Handling of configuration settings is analogous to [[common_plugin_functions|plugins]]. Use '' |
- | A list of available functions can be found in [[http:// | ||
- | ==== tpl_content() | + | ===== Inner workings explained ===== |
- | This function outputs the page body, or in other words the content of your wiki page, including the [[:TOC]]. You can prevent it from outputting the TOC by passing '' | + | |
- | <code php> | + | ==== Functions ==== |
- | tpl_content(false); | + | |
- | </ | + | |
- | This can be used to separate the TOC from the content and place it somewhere else on the screen. See '' | + | A list of available functions |
- | ==== tpl_toc() ==== | + | * **'' |
- | + | tpl_content(false); | |
- | By default, the '' | + | </ |
- | **Example: | + | * **'' |
- | + | ||
- | <code php> | + | |
<div id=" | <div id=" | ||
<?php tpl_content(false)?> | <?php tpl_content(false)?> | ||
Line 56: | Line 71: | ||
<?php tpl_toc()?> | <?php tpl_toc()?> | ||
</ | </ | ||
- | </ | + | </ |
- | + | ||
- | The '' | + | |
- | + | ||
- | **Example: | + | |
- | + | ||
- | <code php> | + | |
<?php | <?php | ||
// render the content into buffer for later use | // render the content into buffer for later use | ||
Line 79: | Line 88: | ||
</ | </ | ||
- | ==== tpl_getConf() | + | * **'' |
- | This function is used to access [[configuration|configuration settings]] from within the template. | + | |
- | ===== Global Variables And Constants | + | * **'' |
+ | |||
+ | * Further many other useful template functions are available. Please have a look in [[xref> | ||
+ | |||
+ | ==== Global Variables And Constants ==== | ||
For a complete list of useful global variables and constants please refer to the [[environment]] page. | For a complete list of useful global variables and constants please refer to the [[environment]] page. | ||
- | ===== Automated Housekeeping ===== | + | ==== Automated Housekeeping ==== |
+ | |||
+ | Almost at the bottom of the default template' | ||
+ | |||
+ | ==== ' | ||
+ | |||
+ | A class named '' | ||
+ | |||
+ | ==== Include Hooks ==== | ||
+ | |||
+ | Include Hooks are a simple way to add some static content to your [[: | ||
+ | |||
+ | The DokuWiki' | ||
+ | |||
+ | ===== Converting existing templates ===== | ||
+ | |||
+ | If you're lacking design skills you can also convert existing templates. There are lots of free options available. If you'd like to publish one of those as well, please make sure it is [[https:// | ||
+ | |||
+ | * [[WP_to_DW_template|How to convert a WordPress theme to a DokuWiki template]] | ||
+ | |||
+ | ===== Avoiding problems ===== | ||
+ | |||
+ | Here are a few problems template developers run into and how to avoid them: | ||
+ | |||
+ | ===Don' | ||
+ | This includes '' | ||
+ | |||
+ | ===Turn off " | ||
- | Almost at the bottom of the default | + | Some template |
- | ===== ' | + | ===Use " |
+ | You can accomplish this by pressing Ctrl+F5 or by holding down shift-control-alt and hitting the refresh button in your browser. | ||
- | A class named '' | + | This is not due to how DokuWiki works, but how current browsers cache files. Browsers cache stylesheets even when new versions are available, so you will need to do this. |
- | ===== Include Hooks ===== | + | ===== Publishing a Template on dokuwiki.org |
- | Include Hooks are a simple way to add some static content to your [[:DokuWiki]] installation without writing your own [[:Template]]. You can use them for adding | + | If you created |
- | DokuWiki' | + | The page should contain all needed documentation on how to install |
- | __Hint for PHP developers: | + | At the top of the template page a few metadata fields have to be filled |
- | ==== Available Hooks ==== | + | From version Ponder Stibbons on an automated update signalling is possible. For the update process to work properly it is necessary that the date “Last updated on” on the template' |
- | All these files are searched for in the ''lib/tpl/default/'' | + | Uploads are not allowed on dokuwiki.org, |
- | ^ Filename | ||
- | | '' | ||
- | | '' | ||
- | | '' | ||
- | | '' | ||
- | | '' | ||
- | | '' | ||
- | DokuWiki comes with an example '' |
devel/templates.1299914614.txt.gz · Last modified: 2011-03-12 08:23 by 71.183.122.50