2 /* Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com)
4 This script enables the ?skin= and ?setskin= parameters for
5 wiki pages. The ?skin= parameter causes the current page to be
6 displayed with some alternate skin (defined by the WikiAdministrator),
7 the ?setskin= parameter sets a cookie on the user's browser to
8 always display pages with the requested skin.
10 To use this script, define an array called $PageSkinList
11 containing skin names and template files, then
12 include('cookbook/skinchange.php'); in your config.php.
13 An example $PageSkinList to set up 'pmwiki', 'myskin',
14 and 'classic' skins might read:
16 $PageSkinList = array(
19 'classic' => 'myclassicskin');
21 If a URL requests a skin that isn't in this array, then PmWiki
22 defaults to the skin already defined by $Skin.
24 By default, the setskin cookie that is created will expire after
25 one year. You can set it to expire at the end of the browser
26 session by setting $SkinCookieExpires=0;
29 SDV($SkinCookie, $CookiePrefix.'setskin');
30 SDV($SkinCookieExpires, $Now+
60*60*24*365);
32 if (isset($_COOKIE[$SkinCookie])) $sk = $_COOKIE[$SkinCookie];
33 if (isset($_GET['setskin'])) {
34 $sk = $_GET['setskin'];
35 setcookie($SkinCookie, $sk, $SkinCookieExpires, '/');
37 if (isset($_GET['skin'])) $sk = $_GET['skin'];
38 if (@$PageSkinList[$sk]) $Skin = $PageSkinList[$sk];