Welcome to WebmasterWorld Guest from 107.22.14.254

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to reference a universal header Menu

I want a universal header displayed across the website

     
3:37 pm on Nov 24, 2008 (gmt 0)

10+ Year Member



Very simple request, and I thought I would easily find tutorials on it online, but didn't find much.

I have a new universal header for my website (header.php) and I want it displayed all across the website. How can I go about doing this? It is actually in HTML format, and I am not sure if I can keep it like that, or does it have to be saved in .php to be able to display it across the website?

Right now, I am using Front Page's 'Page display' feature, which is not very effective, and I want a better faster way to do this. So that when I change something in the header file, it will be displayed all across the website immediately.

Thanks a lot

4:24 pm on Nov 24, 2008 (gmt 0)

5+ Year Member



You can set 'auto-prepend-file' ini setting, can be set in php.ini, .htaccess or httpd.conf

[uk2.php.net...]

6:22 pm on Nov 24, 2008 (gmt 0)

10+ Year Member



Can I just reference a header.php using a php command in an .html page?

Thanks,

4:46 am on Nov 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you can tell apache to parse .html files as php you can easily include your header.php on top of all those html files.
You can tell apache to parse .thml as php either via httpd.conf or simply by adding this line to .htaccess file in your directory

AddType application/x-httpd-php .html

Once either of them is done , you simply go to lets say

yourSitePage1.html
and add

<?
include "header.php";
?>

on top.

And hey, if you go the httpd.conf route then you will have to restart apache before checking if it works

[edited by: Anyango at 4:47 am (utc) on Nov. 25, 2008]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month