Help - Search - Members - Calendar
Full Version: Skinning Problem
Movable Type Community Forum > Additional Resources > Tips and Tricks
ginakra
Hi all,

I'm getting my blog skinned and the skins/index.php works fine, but when it loads skins/index2.php and you click on "main page", the old skin just comes back. For some reason, the new skin isn't "sticking".

I've looked over the tutorials and files again and I don't see what I missed. Does anyone have any clue what i should be looking for?

This is the code I'm using for skins/index2.php:

QUOTE
CODE
<?php
//if you have more than 15 skins, you'll want to change all of the instances of 15 to a higher number
 if (isset($newskin)) {
   $newskin=(int)$newskin;
   if ($newskin<1) $newskin=1;
   if ($newskin>15) $newskin=1;
 } elseif (isset($skin)) {
   $newskin=(int)$skin;
   if ($skin<1) $newskin=1;
   if ($skin>15) $newskin=1;
 } else {
//if you want your skin to default to something other than the number one skin, change this number.
   $newskin=1;
 }
 $skin=$newskin;
 setcookie('skin',$newskin,time()+(86400*365),'/');
 setcookie('skin',$newskin,time()+(86400*365),'/','.<$MTBlogHost$>');
 setcookie('skin',$newskin,time()+(86400*365),'/','<$MTBlogHost$>');
 $skin=$newskin;
?>
<html>

<head>
 <title>Test your new skin out!</title>

<?php
 $headervar = "<$MTBlogSitePath$>skins/header";
 $extension = ".php";
 include ($headervar.$skin.$extension);
?>

<h1>Like it?</h1>
<p>
Your skin number has been reset to <?php echo "$skin.";?> If you like it, journey on to the <a href="<$MTBlogURL$>">main page</a> of this site and play with it a bit. If it's not quite what you want, you can always <a href="<$MTBlogURL$>skins/index.php">go back</a> and select another.
</p>

<br><br>
<div align="center" class="blogfoot">The setup of skins for <$MTBlogName$> was made possible by a tutorial by <a href="http://www.domesticat.net/" target="_blank">Domesticat</a> with MT help by <a href="http://love-productions.com" target="_blank">love-productions</a>.  </div>

<?php
 $footervar = "<$MTBlogSitePath$>skins/footer";
 $extension = ".php";
 include ($footervar.$skin.$extension);
?>


The cookie is getting written to my hard drive but the skin I chose still doesn't stick.

Any ideas would be appreciated, I'm not sure what to include here as I am muddling through this skinning stuff. Ask for whatever you need to help me smile.gif
ndns
Just because the cookie is there doesn't mean that the website is reading it. You have to make sure that you have also included the cookiecheck.php file at the top of all of the pages you want skinned.

From the Domesticat tutorial, the code is:
CODE
<?

$total_skins = 14;
$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),'/','.domesticat.net');
 $skin=$newskin;


   $headervar = "/path/to/your/site/html/nav/header";
   $footervar = "/path/to/your/site/html/nav/footer";
   $extension = ".php";
?>

Be sure to change $total_skins, $default_skin, $headervar, $footervar, and $extension. Also, make sure to change domesticat.net to your domain name.

Does that help?
ginakra
Thanks for your reply smile.gif

I went back and looked at the cookiecheck stuff and I did have an include for the cookiecheck.php file in each skin's header.php file. I have generated the header and footer files inside MT. The one thing that was different was that only part of the code you provided is in Amy's page...looks like she uses the vars in her header files, and so the vars weren't being passed in mine...because I copied and pasted her cookiecheck.php file and didn't have the vars in my header files.

I tried it Amy's way, which caused a DNS error-- which was odd, then I just used your code above in the cookiecheck.php file. I got a parse error with that:

Parse error: parse error in /home/username/public_html/testblog/skins/cookiecheck.

I get the error 3 times on skins/index.php and once on index2.php. Line 24 starts the ?> code...wtheck?

Any idea? I know no php, and I'm cross-eyed at this point smile.gif
kadyellebee
Since it looks like you used my tutorial (love-productions), and I don't have my codes updated with Amy's latest changes, that's the discrepancy between what you had and what ndns posted. smile.gif The original codes should work, as that's what I used on my site for a long time before I changed to the latest code after I screwed something up on my site settings. LOL!

Can we have a link to your test site? I can see if the cookies are being set on my browser... You might also see what the MTBlogHost tag is being set to (stick that tag in a test template and then view the source?)...

Kristine
kadyellebee
Oh, and you might see what date the cookie is setting as expiration date in your browser. I was having problems with my skin not getting set all of the time, and I think that it had something to do with the date, so I upped it to 730 days instead of 365. smile.gif
nammer
Bumping, because I'm experiencing this problem - technically, though I haven't been using them for the last few months, my site has remained skinned with one skin. Everything working fine and I'm trying to add another, so I created my header and footer index templates and updated the necessary numbers in "skins" and "cookiecheck.php", but the skin doesn't stick beyond skins2.php Try it here - click on skin 2 So that's all good (except the sidebar isn't showing), but when you go to the my main page it's all back to the original.

I'm sticking with the old code because the new code gives me some of the same parse errors mentioned above, but it should work - I have cookiecheck included in my header module.

Obviously, this is an operator error, but I can't find it - I'm getting rusty with skinning!

Donna
oscarf
Looks a bit of a problem beyond the skin sticking. It seems that clicking on a skin is giving all kinds of crazy numbers unrelated to the actual skin. When I click on 2, though, it writes a proper cookie and it sticks, as far as I can see.
nammer
Now I'm embarrassed; when I deleted my cookies and re-asked for them, it worked. See? User error tongue.gif Thanks for looking, oscar!
oscarf
In the end, user error is actually always the best news if you ask me biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.