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

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.