.:Urban-Glam.Com:. .:Urban-Glam.Com:.
.:Home:. .:Gina:. .:Domain:. .:Exits:. .:Tutorials:. .:Myspace:. .:Portfolio:.
Skin Your Site

What is skinning? Basically it is when you have 2 or more layouts on your site. And your visitor can have a choice of what one they want to see. This is great to do if you love making layouts and it will give your site a little something extra.

Before we start anything, your ENTIRE site MUST be coded using PHP includes and have PHP support. If you have not done that yet then please go do that now.

Let's make sure that your cookies are enabled. Click here and do the steps for the browser you use.

Now if you have a big site, this step might take you a little while.

At the very top of every single page there has to be this code...

<?php include ("/home/username/public_html/skins/cookiecheck.php");?> <? include($headervar.$extension); ?>

Be sure to change the username to yours.

At the very bottom of every single page there has to be this code...

<? include($footervar.$extension); ?>

So let's say you have a page named menu.php, this is what it should look like...

<?php include ("/home/username/public_html/skins/cookiecheck.php");?> <? include($headervar.$extension); ?>

Navigation
LINK
LINK

<? include($footervar.$extension); ?>

Once you have that done, open your FTP. Make a new folder in your root directory named skins.

Copy and paste the below HTML code in notepad and name it cookiecheck.php.

<?

$total_skins = 1;
$default_skin = 1;

if (isset($_REQUEST['newskin'])) {
$newskin=(int)$_REQUEST['newskin'];
if ( ($newskin<1) OR ($newskin>$total_skins) )
$newskin=$default_skin;

} elseif (isset($_REQUEST['skin'])) {
$newskin=(int)$skin;
if ( ($skin<1) OR ($skin>$total_skins) )
$newskin=$default_skin;
} else $newskin=$default_skin;

$skin=$newskin;
setcookie ('skin', "", time() - 3600);
setcookie('skin',$newskin,time()+(86400*365),'/');
setcookie('skin',$newskin,time()+(86400*365),'/','.yoursite.com');
$skin=$newskin;

$headervar = "/home/username/public_html/skins/$newskin/header";
$footervar = "/home/username/public_html/skins/$newskin/footer";
$extension = ".php";
?>

There are a few things in this file that you will need to change.

$total_skins = 1; - This is where write your total # of skins, so if you have 5 skins on your site write 5. If you ever add or delete skins make sure to change this #.

$default_skin = 1; - This is the # skin that people will see when they go to your site. So if you want the 3rd skin to be the first that people see enter in 3. If you ever wanna change the default skin make sure to change this #.

setcookie('skin',$newskin,time()+(86400*365),'/','.yoursite.com'); - Just add your site URL. DO NOT put http:// and make sure you leave the period.

$headervar = "/home/username/public_html/skins/$newskin/header"; - Type in your correct username.

$footervar = "/home/username/public_html/skins/$newskin/footer"; - Type in your correct username.

Once you have edited cookiecheck.php, upload it inside the skins folder.

Now it is time to add your skins.Make a new folder named 1 inside the skins folder. Everytime you add a skin just make a new folder and name it the appropriate #.

Open folder 1 and upload your header.php, footer.php, style.css, and layout.

Ok so let's check now if all that work paid off. Make a new page named test.php, in this page add the following code...

<?php include ("/home/username/public_html/skins/cookiecheck.php");?> <? include($headervar.$extension); ?>

TESTING 123

<? include($footervar.$extension); ?>

If your layout and everything came up then you did everything right!

So this is how your FTP should look now...

 home/
  test.php
    skins/
      cookiecheck.php
        1/
         footer.php
         header.php
         style.css

Use the code below so people can change the skins on your site...

<a href="http://yoursite.com/index2.php?newskin=1">Skin 1</a>
<a href="http://yoursite.com/index2.php?newskin=2">Skin 2</a>
<a href="http://yoursite.com/index2.php?newskin=3">Skin 3</a>

You also have to make a page named index2.php. This is the page people go to when they changed the skin, you might wanna have a message like this on that page...

Your skin has been changed to skin <?= $skin ?>.

< Back