THE Posted October 27, 2007 Share Posted October 27, 2007 This is my .htaccess: AddHandler one .htm AddHandler one .html Action one /header.php And my header.php <?php $header = "header.html"; $footer = "footer.html"; $file = $_SERVER["PATH_TRANSLATED"]; readfile($header); readfile($file); readfile($footer); ?> Can someone tell me why this isn't working? I'm all morning on this, want to throw the machine out the window.. I don't know anything about PHP... thank you !!! Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/ Share on other sites More sharing options...
THE Posted October 27, 2007 Author Share Posted October 27, 2007 PS: The site is www.thefredknows.com Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379185 Share on other sites More sharing options...
Wuhtzu Posted October 27, 2007 Share Posted October 27, 2007 "I don't know anything about PHP..." good excuse What exactly do you want to accomplish? If you have a header and a footer like below and would like to include them on your pages you should use include()... header.html: <html> <head> <title>My site</title> </head> <body> footer.html: </body> </html> header.php - which includes header.html and footer.html: <?php include("header.php"); include($file); include("footer.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379188 Share on other sites More sharing options...
THE Posted October 27, 2007 Author Share Posted October 27, 2007 It use to put header.htm and footer.htm on ANY .htm/.html file I uploaded to that directory.. (without any added code to each individual page uploaded) My header and footer are .html pages... and I put this in header.php: <?php include("header.html"); include($file); include("footer.html"); ?> But it still won't work... What am I doing wrong? Thanks for the quick response!! Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379191 Share on other sites More sharing options...
THE Posted October 27, 2007 Author Share Posted October 27, 2007 As an aside, this worked fine with my old host, but he skipped town.. Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379193 Share on other sites More sharing options...
Wuhtzu Posted October 27, 2007 Share Posted October 27, 2007 Okay, I just "misunderstood" you becaues I'm not familiar with the method. Are you allowed to use .htaccess files? Some hosts does not support it... Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379194 Share on other sites More sharing options...
THE Posted October 27, 2007 Author Share Posted October 27, 2007 Okay, I just "misunderstood" you becaues I'm not familiar with the method. Are you allowed to use .htaccess files? Some hosts does not support it... Good thinking! I checked that, though.. If I delete the header.php that it points to it tells me: Not Found The requested URL /header.php/index.htm was not found on this server. Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379195 Share on other sites More sharing options...
THE Posted October 27, 2007 Author Share Posted October 27, 2007 I think, anyway, to heck with doing it this way... I've heard of a way one can include the footer/header with a little piece of code on each page... could I have several different sets of headers/footers and add a different piece of code to a page to call them up?? Like this, I could have one line of code that would make that .htm page have adsense header/footer and another line of code to make the page have my normal header/footer PS: If someone can help me figure out how this is done, I could slide them some dough in Epassporte Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379254 Share on other sites More sharing options...
THE Posted October 27, 2007 Author Share Posted October 27, 2007 I solved it with these <?php include 'header.php'; ?> <?php include 'footer.php'; ?> Thanks folks! Quote Link to comment https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/#findComment-379265 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.