devel:templates
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
devel:templates [2014-05-17 12:15] – fixed typos ach | 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 [[template:starter]] template because it is clean and follows the DokuWiki template standards. | + | 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 starter template | + | - Install the [[template:starter]] template |
- Rename the '' | - Rename the '' | ||
- 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 [[# | + | - Then change your template to your heart' |
- | - Have a look on how [[:DokuWiki]] handles [[CSS]] | + | - When your template |
- | - Handling of configuration settings | + | |
- | When your template is stabilized, you can [[# | + | === Template |
- | + | ||
- | ===Template | + | |
A valid template name (directory): | A valid template name (directory): | ||
Line 23: | Line 20: | ||
* DokuWiki' | * DokuWiki' | ||
* Using underscore will also give a [[: | * Using underscore will also give a [[: | ||
+ | * Spaces '' | ||
* If the same name is used by two different templates | * If the same name is used by two different templates | ||
* they are mutually exclusive and inherent incompatible, | * they are mutually exclusive and inherent incompatible, | ||
- | * furthermore only one of them can have a template homepage on dokuwiki.org. | + | * furthermore only one of them can have a template homepage on [[: |
**It is important to have a unique base field value (i.e. template name) in [[devel: | **It is important to have a unique base field value (i.e. template name) in [[devel: | ||
Line 33: | Line 31: | ||
Templates should follow the following directory structure (all paths are relative to the template directory). | Templates should follow the following directory structure (all paths are relative to the template directory). | ||
- | CSS files are specified in the '' | + | 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 [[xref> | + | |
+ | ===== Inner workings explained ===== | ||
+ | |||
+ | ==== Functions ==== | ||
+ | |||
+ | A list of available functions can be found in [[xref> | ||
* **'' | * **'' | ||
Line 89: | Line 93: | ||
* Further many other useful template functions are available. Please have a look in [[xref> | * Further many other useful template functions are available. Please have a look in [[xref> | ||
- | ===== Global Variables And Constants | + | |
+ | ==== 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' | + | Almost at the bottom of the default template' |
- | ===== ' | + | ==== ' |
A class named '' | A class named '' | ||
- | ===== Include Hooks ===== | + | ==== Include Hooks ==== |
- | Include Hooks are a simple way to add some static content to your [[: | + | Include Hooks are a simple way to add some static content to your [[: |
- | The DokuWiki' | + | The DokuWiki' |
- | __Hint for PHP developers: | + | ===== Converting existing templates ===== |
- | ==== Available Hooks ==== | + | 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:// |
- | All these files are searched for in the template | + | * [[WP_to_DW_template|How to convert a WordPress theme to a DokuWiki |
- | ^ Filename | + | ===== Avoiding problems ===== |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | See also [[:include hooks]] | + | Here are a few problems template developers run into and how to avoid them: |
+ | |||
+ | ===Don' | ||
+ | This includes '' | ||
+ | |||
+ | ===Turn off " | ||
+ | |||
+ | Some template developers experience problems with DokuWiki cacheing CSS and JS files due to this option being on, although this has been hard to pinpoint. To be safe, turn this off temporarily. | ||
+ | |||
+ | ===Use " | ||
+ | You can accomplish this by pressing Ctrl+F5 or by holding down shift-control-alt and hitting | ||
+ | |||
+ | 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. | ||
===== Publishing a Template on dokuwiki.org ===== | ===== Publishing a Template on dokuwiki.org ===== | ||
Line 132: | Line 143: | ||
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' | 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' | ||
- | Uploads are not allowed on dokuwiki.org, | + | Uploads are not allowed on dokuwiki.org, |
+ |
devel/templates.1400321739.txt.gz · Last modified: 2014-05-17 12:15 by ach