DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:templates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:templates [2020-04-07 20:23] desbestdevel:templates [2023-09-24 01:08] (current) Klap-in
Line 13: Line 13:
   - When your template is ready, consider [[#Publishing a Template on dokuwiki.org|publishing]] it on DokuWiki's [[:template]] page.   - When your template is ready, consider [[#Publishing a Template on dokuwiki.org|publishing]] it on DokuWiki's [[:template]] page.
  
-===Template naming conventions===+=== Template naming conventions ===
  
 A valid template name (directory): A valid template name (directory):
Line 20: Line 20:
     * DokuWiki's infrastructure doesn't support them anywhere     * DokuWiki's infrastructure doesn't support them anywhere
     * Using underscore will also give a [[:popularity|popularity]] rating of zero.      * Using underscore will also give a [[:popularity|popularity]] rating of zero. 
 +  * Spaces '' '' are also not allowed in the base name of the template defined in ''template.info.txt'' and the folder name, including the page name used in the [[:templates|template listing]] e.g. ''template:myfirsttemplate''
   * 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 [[:dokuwiki|dokuwiki.org]]
  
 **It is important to have a unique base field value (i.e. template name) in [[devel:template_info|template.info.txt]] or an already existing template with that name could be overwritten.** **It is important to have a unique base field value (i.e. template name) in [[devel:template_info|template.info.txt]] or an already existing template with that name could be overwritten.**
Line 30: 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#style.ini]]'' file. Use as many files as you like, but you should at least provide one CSS file for the screen presentation and one for printing.+CSS files are specified in the ''[[style.ini]]'' file. Use as many files as you like, but you should at least provide one CSS file for the screen presentation and one for printing.
  
   * ''<dokuwiki>/lib/tpl/<template>/''   * ''<dokuwiki>/lib/tpl/<template>/''
Line 98: Line 99:
 ==== Automated Housekeeping ==== ==== Automated Housekeeping ====
  
-Almost at the bottom of the default template's [[devel:templates:main.php]] file you'll see a function call to ''[[xref>tpl_indexerWebBug()]]''. The function generates a HTML ''%%<img>%%'' tag which results in a request to ''[[:indexer|lib/exe/indexer.php]]''. This **vital** part of DokuWiki provides important housekeeping work to keep the wiki running smoothly. All templates should include this function, without it the wiki may not function correctly (for example the [[:search|search index]] wont be built).+Almost at the bottom of the default template's [[devel:templates:main.php]] file you'll see a function call to ''[[xref>tpl_indexerWebBug()]]''. The function generates a HTML ''%%<img>%%'' tag which results in a request to ''[[:taskrunner|lib/exe/taskrunner.php]]''. This **vital** part of DokuWiki provides important housekeeping work to keep the wiki running smoothly. All templates should include this function, without it the wiki may not function correctly (for example the [[:search|search index]] wont be built).
  
 ==== 'dokuwiki' class ==== ==== 'dokuwiki' class ====
Line 108: Line 109:
 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 a standard header at the top or a disclaimer at the bottom of each page. 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 a standard header at the top or a disclaimer at the bottom of each page.
  
-The DokuWiki's default template looks for files with special names in the template directory and simply includes them at the correct places when displaying the page. You can add whatever HTML or even PHP you like into these files. Of course this only works if you are using the //default// template or a template supporting the [[template:dokuwiki#supported_include_hooks|same include hooks]] (like the starter template).+The DokuWiki's default template looks for files with special names in the template directory and simply includes them at the correct places when displaying the page. You can add whatever HTML or even PHP you like into these files. Of course this only works if you are using the //dokuwiki// template or a template supporting the [[template:dokuwiki#supported_include_hooks|same include hooks]] (like the starter template).
  
 ===== Converting existing templates ===== ===== Converting existing templates =====
Line 144: Line 145:
 Uploads are not allowed on dokuwiki.org, so you need to host your template files somewhere else. We recommend to manage your source with a Revision Control System like [[git]]. If you do, it's easiest to use a public repository host like [[https://github.com|GitHub]] which also offers a bug tracker for your repository. Uploads are not allowed on dokuwiki.org, so you need to host your template files somewhere else. We recommend to manage your source with a Revision Control System like [[git]]. If you do, it's easiest to use a public repository host like [[https://github.com|GitHub]] which also offers a bug tracker for your repository.
  
-===== See Also ===== +
-If you are converting a wordpress theme to a dokuwiki template, it's worth looking at [[devel:wp_to_dw_template|this page]].+
devel/templates.1586283781.txt.gz · Last modified: 2020-04-07 20:23 by desbest

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki