Revision [2288]
This is an old revision of WikkaSkinSelector made by DarTar on 2004-11-18 09:32:58.
Wikka Skin Selector
This action allows to select a WikkaSkins skin for HomePage WikkaWiki, among those present in the css/ folder.
Your browser must accept cookies in order for the skin selector to work.
Here's the three-step installation:
1. Add your custom WikkaSkins skins
Just put all your skins in the css/ folder of your Wikka installation.
Many skins can be downloaded and shared from the unofficial WikkaSkinsRepository.
2. Create the skin selector action (actions/selectskin.php)
Save the code below in a new file called actions/selectskin.php:
(php) // Wikka Skin Selector // Displays a form to switch CSS stylesheet <?php $currentskin = $this->GetCookie("wikiskin"); echo $this->Format("=== Skin Switcher === --- "); if ($_POST) { $this->SetPersistentCookie("wikiskin", $_POST["skin"]); $this->Redirect($this->href()); } echo $this->Format("Current skin: **".$currentskin."** --- --- "); $handle = opendir('css/'); print $this->FormOpen("","","post"); echo '<select name="skin">'; while (false !== ($file = readdir($handle))) { if (ereg("[^xml|^print]\.css", $file)) { print '<option value="'.$file.'">'.$file.'</option>'; } } echo '</select>'; echo '<input type="submit" name="Submit" value="Set new skin">'; print $this->FormClose(); closedir($handle); ?>
3. Modify the Wikka Header (actions/header.php)
To allow skin selection a small modification of the header is needed:
original actions/header.php
<link rel="stylesheet" type="text/css" href="css/<?php echo $this->GetConfigValue("stylesheet") ?>" />
modified actions/header.php
<link rel="stylesheet" type="text/css" href="css/<?php echo ($this->GetCookie("wikiskin"))? $this->GetCookie("wikiskin"): $this->GetConfigValue("stylesheet") ?>" />
How to use the skin selector
Just insert {{selectskin}} in a wikka page and start playing.
-- DarTar