homepage Welcome to WebmasterWorld Guest from 54.234.228.64
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How to reference a universal header Menu
I want a universal header displayed across the website
asas111




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

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

 

mrscruff




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

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

[uk2.php.net...]

asas111




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

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

Thanks,

Anyango




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

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved