rss
Welcome

Hi! You've stumbled upon the personal site slash blog of Charity, you can call me CeeCee, fatally flawed, brutally honest, and girly by nature. Have a look around and comment if you feel compelled. Got a question? Feel free to ask me! I'll answer at my discretion. Enjoy your stay and come back soon.


Quick Links


PHP Site Skinning

To skin your site you will need to have knowledge of php includes and your site pages should be in php. If not I suggest you learn those basics before you try to skin your site. Now let's begin...

You should already have at least two layouts coded before beginning. Put all files and images for your first layout in a folder and name it 1. This includes your header.php, footer.php, stylesheet and any images that pertain to your first layout.

Now do the same for your second, third, ect.. All layouts should be in individual folders with the number of the layout, so all second layout files in a folder named 2, third layout in a folder named 3 and so on.

Now connect to your FTP server and in your root directory make a new folder and name it skins. Now upload your numbered layout folders to this directory.

Once that is complete you will need to create a new page using a text editor. In the new page copy and paste the code below and name the file cookiecheck.php:

<?php if(!empty($_GET)) extract($_GET);
if(!empty($_POST)) extract($_POST);
if(!empty($_COOKIE)) extract($_COOKIE);
$total_skins = 2;
$first_skin = 1;
srand ((double)microtime()*1000000);
$default_skin = 2;
$domain = "yoursite.com";
if (isset($_REQUEST['newskin'])) { $newskin=(int)$_REQUEST['newskin'];
if ( ($newskin<$first_skin) OR ($newskin>$total_skins) )
$newskin=$default_skin; } elseif (isset($_REQUEST['skin'])) { $newskin=(int)
$skin;
if ( ($skin<$first_skin) 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),'/',$domain);
ob_end_flush();
$skin=$newskin;
$headervar = "/home/USER/public_html/skins/$newskin/header";
$footervar = "/home/USER/public_html/skins/$newskin/footer";
$extension = ".php"; ?>

A little confusing but keep going! Now in this code you just copied there are a few things that need to be edited. At the top where it says $total_skins = 2; thats how many skins you have in total. Change the 2 to the number of layout folders you uploaded to the skins directory. You need to make sure you change the number of total skins in this file everytime you add a new skin or else it wont work.

Now where it says $default_skin = 2; this represents the number of the skin you would like the vistor to see the first time they come to your site. Set it to the number of the skin you want.

Next find this line that says $domain = "yoursite.com"; and change yoursite.com to your url no http:// or trailing slash (/).

Next find the two lines at the end of the file that say

$headervar = "/home/USER/public_html/skins/$newskin/header";
$footervar = "/home/USER/public_html/skins/$newskin/footer";


Change the path /home/USER/public_html/skins/ to the absolute path to your skins folder. If you don't know your path ask your host or find it your self with this tutorial. Be sure to change the path on both of these lines. Be sure to keep the beginning slash and the $newskin/footer at the end.

Now save the file cookiecheck.php and upload it to your skins directory.

For every page of content on your site you will need to include 3 additional codes. At the very top of the content pages paste this code:

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

In the first code replace the path to cookiecheck.php with yours.

Now at the very end of your content pages place this code:

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

Again be sure to do this with all content pages or they will not be skinned correctly.

If you have done everything properly your site should now be skinned! Now all you need is the codes so your visitors can select which skin they want to view your site. For text links use this code:

<a href="http://yoursite.com/index.php?newskin=1" target="_top">title of skin</a>

For image links use this code:

<a href="http://yoursite.com/index.php?newskin=1" target="_top"><img src="http://urltoimage.jpg" border="0"></a>

Make sure you change the urls to those for your site. That's it! View your site in your browser to see if it worked correctly. I know skinning can be tough at first so if you have any questions don't hesitate to ask!



« back


LethalPink is powered by WordPress © 2010 unless stated otherwise