Learn about DokuWiki
Learn about DokuWiki
Important If your DokuWiki is older than Angua or if the templates you are using it with are not up-to-date1), you have to make the following small change to DokuWiki's source code. Otherwise you might get partially (or completely) blank pages.
Remove (or comment) the following lines in
// DEPRECATED, use tpl_basedir() instead if(!defined('DOKU_TPL')) define('DOKU_TPL', DOKU_BASE.'lib/tpl/'.$conf['template'].'/'); // DEPRECATED, use tpl_incdir() instead if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC', DOKU_INC.'lib/tpl/'.$conf['template'].'/');
Fixing templates is easy. Just replace every
tpl_incdir() and every
tpl_basedir() (see their deprecation).
This plugin can be used in two ways:
Although you can use both ways together, it is advisable to only use one method or the other. Because otherwise you need to decide2) which choice is the preferred one.
The plugin comes with an admin component you'll find in the admin menu. Use it to specify the templates to be used for different wiki pages or namespaces. Pages not covered by one of these rules will still use the template specified by the template variable in the admin interface.
Alternatively the plugin can let the user choose the template for the whole wiki through a template switcher. Your users will need to allow cookies for that (otherwise the template won't switch permanently).
|Automatically output the template switcher on every page (turn this off if you don't want to show the template switcher or want to put it somewhere else)|
|Exclude templates from template switcher (comma-separated list)|
|Show mobile template switcher (with only 1 normal and 1 mobile template)?|
|Mobile template (if showing mobile template switcher)|
|Prefer user's template choice over admin's choice (turn this off to let the admin's choice have the preference)|
|Inherit template choice per namespace inside a language namespace (when using the translation plugin)|
|Allow template choice to persist in admin section 3)|
The template switcher is automatically put before the wiki content. If you like to put it somewhere else (e.g. near the login button or into the sidebar), you need to switch
automaticOutput and put the following code into your template to wherever you like to display it:
<?php $loadskinHelper = plugin_load('action', 'loadskin')->loadHelper('loadskin', true); echo $loadskinHelper->showTemplateSwitcher(); ?>
The styling which come with the plugin will suit most templates when it's automatically put before the wiki content. But some templates might need a little help with user styles.
This plugin doesn't set any new cookies, but uses the
DOKU_PREFS cookie which the DokuWiki core already uses. If a user uses the template switcher, it sets
loadskinTpl to the chosen template. It also sets
loadskinOrig to the original template which would show if nothing had been chosen.
A complete changelog is available here.