Template Switcher

This is a plugin to easily let people switch the template of the DokuWiki for the current Session. This might be helpfull to provide several templates for peoples needs. I.e. there is your normal layout and a layout that makes everything bigger. With this plugin the user can decide which one he likes to see.

Syntax

To use the tplSwitcher, you can add the following code into an wikipage

// create a single button to change to default template
{{tplSwitcher>default|Default}}

// create a select field to choose a template from
{{tplSwitcher>default|Default||original|Original}}

// in addition to either of the syntax above, you can have some text in front
{{tplSwitcher>default|Default%<optional_text>}}

// NEW: Switch the layout when clicking another page
{{tplSwitcher>Page>thePageYouWant%templateName}}

If you do not want to insert this code into a DokuWiki page, but you want the template-swtiching be handled by the template itself, you can add the follwing code to generate a single button with the link to change the template.

<?php tplSwitcher('<template name>', '<button description>')?>

Example

The follwing is an example:

Select another Layout to look, what it is like:

Download

date files changes
2007-02-22 tplswitcher.20070222.tgz New option “Page>” to change the Template while clicking a link
2006-11-13 tplswitcher.20061113.tgz Bugfix for at least Iex 7.0 & Opera 9.0 - the Caching prohibited the Browser to load the correct style
2006-10-31 tplswitcher.20061031.tgz Bugfix for at least Iex & Opera - the Caching prohibited the Browser to load the correct style
2006-08-14 tplswitcher.20060814.tgz Changed some things to how the Plugin works. It still is a kind of Action Plugin though it does not require the registering hook anymore but injects some code. It is highly possible that this version does not work properly behind proxys (a hard reload via Ctrl+R solved that)
2006-08-01 tplswitcher.20060801.tgz initial

Hints for the initial Version

:!: For the Initial Version it is only possible to change the layout via loading another template out of your /lib/tpl folder, but there is no possibility to load the styles via /lib/exe/css.php. Therefore I suggest to hardcode the style into your template via

<link rel="stylesheet" media="screen" type="text/css" href="/lib/tpl/*your_template*/layout.css"/>
<link rel="stylesheet" media="screen" type="text/css" href="/lib/tpl/*your_template*/design.css"/>
<link rel="stylesheet" media="print" type="text/css" href="/lib/tpl/*your_template*/print.css"/>

This has to take place after the tpl_metaheaders() function.

authoring tool: counter
content: © 2010 Gerry Weißbach @ gammaproduction.de