View Single Post
Old 01-15-2004, 07:02 PM   #1 (permalink)
Sean
 
Sean's Avatar
 
Title: Founder/Admin
Join Date: Jan 2004
Location: Sydney, Australia
Age: 28
Posts: 8,907
Blog Entries: 4
Rep Power: 10 Sean will become famous soon enough
Send a message via MSN to Sean Send a message via Skype™ to Sean
Thumbs up [PHP] Creating Headers and Footers

Including headers and footers from a page can save u alot of time and effort.

When u want to edit the header for example u only have to edit one file instead of 20+ depending on how many pages your site has.

For example your index.php or link.php will call upon the headers and footers like this.

index.php
PHP Code:
<?php require_once($DOCUMENT_ROOT '/header.php'); ?>
<hr>
<center>Web Content</center>
<hr>
<?php require_once($DOCUMENT_ROOT '/footer.php'); ?>
Then your headers and footers would look like this:

header.php
HTML Code:
<HTML>
<HEAD>
  <TITLE>Test Page</TITLE>

<LINK REL=stylesheet TYPE="text/css" HREF="styles.css">
</HEAD>

<body bgcolor="#00000"> 
Footer.php
HTML Code:
<p>Tutorial by Bluepearl Design
</BODY>
</HTML> 
As u can see this is very easy, and editing copyrights etc will take no time at all

U could also add menu's using this feature which would mean changing links would only mean changing one file instead of say 20+

example:
HTML Code:
<td width="100" class="menu"><?php require_once($DOCUMENT_ROOT . '/menu.inc'); ?></td> 
If u dont understand any this dont hesistate to ask

Last edited by Sean; 06-09-2005 at 04:43 AM.
Sean is offline   Reply With Quote