Jump to content

[SOLVED] PHP header/footer... driving me crazy


THE

Recommended Posts

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 !!!

Link to comment
https://forums.phpfreaks.com/topic/74980-solved-php-headerfooter-driving-me-crazy/
Share on other sites

"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");
?>

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!!

 

 

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.