Comparing revisions for WikkaSkinSelector
- [2447] 2004-11-25 13:21:17 by DarTar (unregistered user) [Minor code modification]
- [20847] 2009-09-12 07:36:07 by DarTar (unregistered user) [link to blog post]
Additions:
===== Wikka Skin Selector =====
{{lastedit}}
<<Check also the WikkaSkinEditor, which extends the WikkaSkinSelector giving Wikka Administrators the possibility to **edit skins**<<::c::
This action allows you to select a [[WikkaSkins skin]] for [[HomePage WikkaWiki]], among those present in the ##css/## folder.
__Note__: 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##:
''Minor update 2004-11-22''
%%(php)
<?php
// Wikka Skin Selector
// Displays a form to switch CSS stylesheet
$currentskin = $this->GetCookie("wikiskin");
echo $this->Format("=== Select a Wikka skin: === --- ");
if ($_POST) {
$this->SetPersistentCookie("wikiskin", $_POST["skin"]);
$this->Redirect($this->href());
}
$handle = opendir('css/');
print $this->FormOpen("","","post");
echo '<select name="skin">';
$noskinmask = '^(xml.css|print.css|\.(.*))$';
while (false !== ($file = readdir($handle))) {
if (!preg_match('/'.$noskinmask.'/', $file)) {
$selected = ($file == $currentskin)? " selected" : "";
print '<option value="'.$file.'"'.$selected.'>'.$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##**
%%(php)
<link rel="stylesheet" type="text/css" href="css/<?php echo $this->GetConfigValue("stylesheet") ?>" />
%%
**modified ##actions/header.php##**
%%(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
----
CategoryDevelopment CategoryLayout
{{lastedit}}
<<Check also the WikkaSkinEditor, which extends the WikkaSkinSelector giving Wikka Administrators the possibility to **edit skins**<<::c::
This action allows you to select a [[WikkaSkins skin]] for [[HomePage WikkaWiki]], among those present in the ##css/## folder.
__Note__: 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##:
''Minor update 2004-11-22''
%%(php)
<?php
// Wikka Skin Selector
// Displays a form to switch CSS stylesheet
$currentskin = $this->GetCookie("wikiskin");
echo $this->Format("=== Select a Wikka skin: === --- ");
if ($_POST) {
$this->SetPersistentCookie("wikiskin", $_POST["skin"]);
$this->Redirect($this->href());
}
$handle = opendir('css/');
print $this->FormOpen("","","post");
echo '<select name="skin">';
$noskinmask = '^(xml.css|print.css|\.(.*))$';
while (false !== ($file = readdir($handle))) {
if (!preg_match('/'.$noskinmask.'/', $file)) {
$selected = ($file == $currentskin)? " selected" : "";
print '<option value="'.$file.'"'.$selected.'>'.$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##**
%%(php)
<link rel="stylesheet" type="text/css" href="css/<?php echo $this->GetConfigValue("stylesheet") ?>" />
%%
**modified ##actions/header.php##**
%%(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
----
CategoryDevelopment CategoryLayout
Deletions:
<<===Theme support available in 1.2!===
This page refers to beta functionality supported until Wikka 1.1.x. As of [[Docs:WhatsNew12 version 1.2]] Wikka introduces support for 100%-modular **themes**: check [[Docs:WikkaThemes this page]] for more information or this [[http://blog.wikkawiki.org/2009/09/11/how-to-design-themes-for-wikkawiki/ tutorial]] to learn how to design custom themes.
<<::c::
This action allows you to select a [[Docs:WikkaSkins skin]] for [[HomePage WikkaWiki]], among those present in the ##css/## folder.
__Note__: 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##:
''Minor update 2004-11-25''
%%(php)
<?php
// Wikka Skin Selector
// Displays a form to switch CSS stylesheet
$currentskin = $this->GetCookie("wikiskin");
echo $this->Format("=== Select a Wikka skin: === --- ");
if ($_POST) {
$this->SetPersistentCookie("wikiskin", $_POST["skin"]);
$this->Redirect($this->href());
}
$handle = opendir('css/');
print $this->FormOpen("","","post");
echo '<select name="skin">';
$noskinmask = '^(xml.css|print.css|\.(.*))$';
while (false !== ($file = readdir($handle))) {
if (!preg_match('/'.$noskinmask.'/', $file)) {
$selected = ($file == $currentskin)? " selected=\"selected\"" : "";
print '<option value="'.$file.'"'.$selected.'>'.$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##**
%%(php)
<link rel="stylesheet" type="text/css" href="css/<?php echo $this->GetConfigValue("stylesheet") ?>" />
%%
**modified ##actions/header.php##**
%%(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
----
CategoryDevelopmentActions CategoryLayout