Tutorials
Skinning: Customising your skins page
-
Skinning: Customising your skins page
Posted on May 20, 2005
Written by
Vixx (view more by Vixx)
Comments (0)
Filed under PHP, Tutorials
If you have skinned your site and offer visitors several different themes to pick from, this tutorial will show you how to customise your skins.php page so that it changes the information about the current layout according to what skin your visitor is using.
Although this means we have to use cookies and a little PHP, you don’t need to know much about them to implement this . . . although it should go without saying that you should have already implemented my skinning tutorial successfully for this to work!
Please note that I have not tested this method with any skinning tutorial other than the one I wrote myself here at CodeGrrl, but there isn’t a reason why this shouldn’t work with any other skinning method as they’re all essentially the same.
Step One:
On my own version of skins.php I have a small introduction about skins and some screencaps to show visitors what the layouts are like before you reach the heading “About This Layout”, but you can actually place this anywhere you like on the page. So wherever you want your layout information to display, add this:
<?php
if ($_COOKIE['skin'] == 1) {
echo "<h2>About This Layout</h2>
<p>You’re currently viewing theme 1 entitled \"NAME OF SKIN\" which was uploaded on DATE OF UPLOAD.</p>”;
}
?>
You can add as much information as you like - as you can see on my site, I talk about what resolutions and browsers the skin is optimised for, credits for images, validation details etc. etc. You can also use HTML as normal, although you will need to remember that any "s (speechmarks) need to be prefixed with a backslash ( \ ) in order for the page to display properly. For instance, if you have a link like:
<a href="http://furious-angel.com">Click here!</a>
You will need to change it to:
<a href=\"http://furious-angel.com\">Click here!</a>
Step Two:
Add the snippet in Step One for every skin/layout you have, changing
if ($_COOKIE['skin'] == 1)
to:
elseif ($_COOKIE['skin'] == 2)
and so on, according to whichever skin number you’re referring to.
Step Three:
That’s it - all done!
You should now have a skins.php that displays only one "About This Layout" section that changes according to what skin number your visitor has selected!
Comments
Comments are closed for this entry.