PDA

View Full Version : Adding a Header and Footer to Existing HTML Files



Stu
08-02-2007, 02:54 PM
I'd like to add a header.html and footer.html to a large group of existing html files. These files are auto generated and constantly changing, so editing them isn't an option.

I've heard of people using htaccess to redirect, using frames, and php auto_prepend_file/auto_append_file

What's the best method to go about this? I'd prefer to stay away from frames because I want my links to work and display in the address bar.

Does php auto_prepend_file/auto_append_file work on bluehost? If so, how would I go about implementing it in my site?

Thanks in advance.

Basil
08-02-2007, 03:00 PM
auto_prepend and append work, but may not be the best solution. How are the files generated?

Stu
08-02-2007, 03:05 PM
auto_prepend and append work, but may not be the best solution. How are the files generated?

They're generated from a game, and are updated weekly. I have no control over the html file generation unfortunately

Basil
08-02-2007, 03:13 PM
php.ini file

auto_prepend_file ../header.php
auto_append_file ../footer.php

This file has to be in the folder it's being applied to, and I would put the header and footer files in a different folder.. like the one above it.

Stu
08-02-2007, 03:22 PM
Do I just create a new php.ini file and drop it in the folder? Does it apply to subfolders as well?

Basil
08-02-2007, 03:24 PM
php.ini files do not filter down into lower level folders. I would just go ahead and create a new php.ini file in the folder you want to modify.

Stu
08-03-2007, 07:59 AM
Does the server need a reboot before changes to php.ini take effect? I'm not sure if I'm just not being patient enough, but it doesn't seem to be doing anything. I've looked it up on the web and most instructions look exactly like yours, so I think the syntax is correct. I tried doing it in .htaccess but it appears Bluehost doesn't allow that. Any ideas?

Basil
08-03-2007, 09:40 AM
Nah, changes should be instant, I'll write up an exact demonstration of what you're after, but I can't do it right now, I'm working on a project for a company.

Stu
08-03-2007, 09:49 AM
Nah, changes should be instant, I'll write up an exact demonstration of what you're after, but I can't do it right now, I'm working on a project for a company.

Awesome. Thanks for all your help Basil.

Stu
08-03-2007, 01:38 PM
I figured out the issue Basil. It was the syntax.


auto_prepend_file ../header.php
auto_append_file ../footer.php

should be:



auto_prepend_file = ../header.php
auto_append_file = ../footer.php

Thanks again for your help.

Basil
08-03-2007, 02:14 PM
Nice call.

That was my bad, I was thinking it was like 'include'.