H I O X INDIA
FREE PHP Topics
Google
Web hscripts.com
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

PHP Topics
Introduction
Common Header
Random Number
Type
Form Variables
Date and Time
File Handling
Error Handling
DB Size
PHP Mail
String Tokens
Running PHP from JS
Array To JS
Array to PHP
Encryption
Ask Your Doubts
Feedback





Header and Footer


Topic

How to have my header portion in a single file and use it accross at all files?
What is a header and footer in html?



Explanation

It is very simple to do this using php.
Most of the commercial website use common header and footer files. It will be so helpful because when we want to change any information it is enough if we do it in a single file rather then duplicating it.
It will be so easy to add the change just in single file instead of all the files we have.

Follow the steps to do it yourself


Step 1:
Create a file as head.php and have all your header info in it

Example:You will have something like this in head.php
<html>
<head>
</head>
<body>
<table width=80% height=30>
<tr>
<td>
<div align=center> Page Title </div>
//Other links for home,support etc.....
</td>
</tr>
</table>


Step 2:
Now create your main files. In all the files just use "include" to have the header.
Lets say we have index.php, the code in it will look like this

<?php
include 'head.php';
?>

<table width=80% height=100%>
<tr>
<td>
//All you contents to follow
.......
......
</body>
</html>


Note: So the header file head.php will be included in all files which will have a common header. The same thing can be done for footer too. Make sure that the all files are named with .php extention.






others


privacypolicy     licence     sitemap
(c) copyright, 2004 hioxindia.com