Well of Stars

Tips and Troubleshooting: Skins and subdomains

Sometimes I have found that when both the main domain and a subdomain are skinned, the skins on the subdomain do not work properly. After changing skins, it reverts back to the default as soon as you move to another page...

- The solution that worked for me was to edit the cookies.php file, changing every occurrance of skin and newskin so that the cookie set by the subdomain looked for different variables to the one set by the main domain.

For example:

<?php

$total_skins = 5;
$default_skin = 3;

if (isset($_GET['mynewskin'])) {
$mynewskin = (int)$_GET['mynewskin'];
if ($mynewskin < 1) { $mynewskin = $default_skin; }
if ($mynewskin > $total_skins) { $mynewskin = $default_skin; }
}
elseif (isset($_COOKIE['myskin'])) {
$mynewskin = (int)$_COOKIE['myskin'];
if ($mynewskin < 1) { $mynewskin = $default_skin; }
if ($mynewskin > $total_skins) { $mynewskin = $default_skin; }
}
else {
$mynewskin = $default_skin;
}
$myskin=$mynewskin;
setcookie('myskin',$myskin,time()+(86400*365),'/');
setcookie('myskin',$myskin,time()+(86400*365),'/','yourdomain.com');

$headervar = $_SERVER['DOCUMENT_ROOT']."/skins/$mynewskin/header";
$footervar = $_SERVER['DOCUMENT_ROOT']."/skins/$mynewskin/footer";
$extension = ".php";
?>

You can rename 'skin' and 'newskin' however you like, as long as you change them all in the same way. You will also need to change the links to your skins: whatever name you have given to 'newskin' will also need to go in the link, for example <a href="?mynewskin=1">

On to tips and troubleshooting: iframes (or scrolling divs)
Back to contents