Help - Search - Members - Calendar
Full Version: Skinning Error
Codegrrl.com Forums > Script Help > Tutorial Help
Zee
I'm trying to skin a site, and I'm getting the following error on the index page at http://anime.just-peachy.com/index.php:

CODE
[b]Warning[/b]:  include(/home/peachy/public_html/anime/nav/header.php) [[url="http://just-peachy.com/anime/function.include"]function.include[/url]]: failed to open stream: No such file or directory in [b]/home/peachy/public_html/anime/index.php[/b] on line [b]2[/b]
  
  [b]Warning[/b]:  include() [[url="http://just-peachy.com/anime/function.include"]function.include[/url]]: Failed opening '/home/peachy/public_html/anime/nav/header.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in [b]/home/peachy/public_html/anime/index.php[/b] on line [b]2[/b]


Same error for the footer. I checked the paths and coding for both the includes and the cookiecheck.php and everything seems in order:

CODE
$total_skins = 2;
$default_skin = 2;

if (isset($_GET['newskin'])) $newskin = (int)$_GET['newskin'];
elseif (isset($_COOKIE['skin'])) $newskin = (int)$_COOKIE['skin'];
else $newskin = $default_skin;

if (empty($newskin) || $newskin < 1 || $newskin > $total_skins) $newskin = $default_skin;

setcookie('skin', $newskin, time()+(86400*365), '/');

$headervar = "/home/peachy/public_html/anime/nav/header";
$footervar = "/home/peachy/public_html/anime/nav/footer";
$extension = ".php";
?>


CODE
<?php include("/home/peachy/public_html/anime/cookiecheck.php");
include($headervar.$skin.$extension);?>


It seems like the code should be accessing header2.php and instead, for some reason it's trying to access header.php, which doesn't exist.

This is likely something really obvious that I'm missing in my frustration, but I could use an extra pair of eyes.
HoL
I had the same problem recently. I'm not sure exactly what the problem is, but I think it has to do with that code not being compatible with never versions of PHP. I tried just modifying it, but after hours could not get it to work, so I wrote my own snippet to use instead, which did work. For mine I had the following:

For cookiecheck.php

CODE

<?php

$total_skins = 3;

$default_skin = 1;

if (isset($_COOKIE['yourcookiesname'])) {$skin=$_COOKIE['yourcookiesname'];}

else {$skin=$default_skin;}


$headervar = "/pathto/header";

$footervar = "/pathto/footer";

$extension = ".php";

?>



And for my setskin.php page (accessed via href setskin.php?newskin=#)

CODE

<?php

$total_skins = 3;

$default_skin = 1;

$newskin=$_GET['newskin'];

if ($newskin!='' AND ($newskin>=1 AND $newskin<=$total_skins)) {setcookie("yourcookiesname",$newskin,time()+(86400*365),"/",".yourdomain.com");}

else {$newskin=$default_skin;}


$skin=$newskin;


$headervar = "/pathto/header";

$footervar = "/pathto/footer";

$extension = ".php";

?>


<?php include($headervar.$skin.$extension); ?>

<p>Your text here.</p>

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


Don't know how fool-proof it is or anything, but it got the skins to work for me. smile.gif
Amelie
Oops, that's an error in the tutorial (I modified it slightly to make it more secure)

You need to add this line to cookiecheck.php (before your header/footer code):

$skin = $newskin;

It was in the tutorial originally, but I must've deleted it by mistake when modifying it. Oops! Sorry about that. Have corrected this now smile.gif
Zee
Oh, thanks a million! Ha ha, I'm glad to know it wasn't just me being completely retarded. ;)
Vixx
Thanks, Amelie. smile.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.