SkinChange
<< Ref Count | Cookbook-V1 | Search Exclude Pages >>
Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
For the equivalent recipe for PmWiki 2, see Cookbook.SkinChange
Question
How can I allow users to change their skin based on a query parameter or cookie setting?
Answer
The Attach:skinchange.php script enables query parameters of the form "?skin=
" and "?setskin=
" to be added to a page url to allow users to view pages with a different skin. The ?setskin=
query stores a cookie on the browser that causes a different skin to be used for all subsequent pages, while ?skin=
only changes skin for the currently displayed page.
To use this script, in the config.php file simply define an array called $PageSkinTemplates that indicates the template file to be used for each skin name, and then do include_once('local/skinchange.php');
. Example:
$PageSkinTemplates = array( 'pmwiki' => 'pub/skins/pmwiki/pmwiki.tmpl', 'classic' => 'pub/skins/classic/classic.tmpl', 'jh' => 'pub/skins/jhskin/jhskin.tmpl'); @include_once('local/skinchange.php');
Some example links using this script:
- ThisPage:?skin=classic - switches to ClassicSkin for this page
- ThisPage:?skin=jh - switches to the JHSkin for this page
- ThisPage:?skin=pmwiki - switches to the PmWiki standard skin
- ThisPage:?setskin=classic - switches to ClassicSkin for all subsequent pages
- ThisPage:?setskin=jh - switches to JHSkin for all subsequent pages
- ThisPage:?setskin= - returns to the default skin
Contributors
- Pm, original script (25-Feb-2004)
- Arndis, ampersand note after Pm suggested the fix (5-Mar-2004)
- Ampersand note no longer needed as of 1.0.0 (19-Jun-2004)
pmwiki-2.3.38 -- Last modified by {{Henning}}