viral marketing strategies










target market left corner image


target markets right corner image


















PHP Include File - How to Use PHP Include to Easily
Maintain Your Web Site
Copyright Herman Drost 

Maintaining or updating a large site is not easy if you
want to make changes to the header, navigation or footer
sections. You will need to edit each page separately. This
will take a long time especially if you have over 100 pages
to update.

Creating a PHP Include file will allow you to easily update
all your pages from one file.

Benefits of PHP Include

1. Update different parts of your site from one file.

2. Include content from other web sites outside your server
(not possible with SSI).

3. No need to create a .htaccess file (needed for SSI).

4. Able to keep the .php extension without renaming it to
some other extension (like *.shtml).

5. You can include files with .php, .html, .asp, .txt and
other extensions.

6. Faster than SSI (server side includes) , and uses less
CPU resources than SSI.

7. Create article or news feeds if the PHP version on
your server supports the function.
Subscribe FREE to
Marketing Tips Newsletter
Please enter your e-mail address below to receive original in-depth Marketing Articles every 2 weeks.

NEW Ebook
101 Highly Effective Strategies to Promote Your Web Site

web site promotion ebook

Hosting Plans from $30/Year

How does PHP Include work?

My example below illustrates how to make the top and bottom
navigation elements of your web page dynamic. This will
enable you to update 1000s of pages by just editing two PHP
Include files.

1. Make sure your web host has PHP installed. Most
reputable hosts do but check with them anyway.

2. Place the content between each of the comment tags below
(ie <!--HEADER --><!--HEADER -->) in a text file and name
it with a .php extension ie header.php (or header.txt) You
can use notepad for this.

Here is an example of a typical web page using CSS
(cascading style sheets) to style the header content ie
<div id="header"></div>.

<title> This is the page title </title>
<!--HEADER -->
<div id="header">
<h1 > This is the header</h1>
<!--HEADER -->

<!--TOPNAV -->
<div id="topnav">
<li><a href="index.php">HOME</a></li>
<li><a href="aboutus.php">ABOUT US</a>
</li> <li><a href="contactus.php">CONTACT US</a></li>
<!--TOPTNAV -->

<!--LEFTNAV -->
<div id="topnav">
<li><a href="index.php">HOME</a></li>
<li><a href="aboutus.php">ABOUT US</a></li>
<li><a href="contactus.php">CONTACT US</a></li>
<!--LEFTNAV -->

3. Name the other include files ie topnav.php and

4. Create a folder called includes and place the
header.php, topnav.php, leftnav.php files in it.

5. Replace the text between the comment tags with your PHP
includes code. i.e.

<div id="header"> <h1 > This is the header</h1></div>

<?php include 'includes/header.php'?>

Do the same for the topnav and leftnav sections.

7. Save your new web page with a .php extension ie
index.php (If you save it with a different extension your
page will get errors when you upload it to your server.

8. Upload your includes folder and CSS style sheet (if you
created one) to the root folder of your server...usually
it's the public_html folder.

9. Open the new web page in your browser. The header,
top navigation and left navigation sections should appear.
Experiment with changing your include files or making other
areas of your web page dynamic. You can then do the same
for future web sites you build and save lots of time maintaining

Frequently asked questions:

Question 1
How can I use PHP include for easy site
maintenance if all my web pages currently have .html or
.htm extensions? I don't want to lose their current search
engine rankings.

Insert the code below into notepad, name it
.htaccess and upload it to the root folder of your server.

AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm

Now just follow the 9 steps as outlined above and you will
be able to keep your current page extensions ( .htm..html
or .php) and still use PHP include. This will allow you to
keep the same search engine rankings as you had before you
made your site dynamic.

Question 2
How can I include content from other sites
using PHP include (not possible using SSI)?

Insert this code on your web pages:

<? include('');?>

Question 3
What PHP include code do I use for web pages
if they are positioned one or several directories away from the
root files of my server? I keep getting errors when I upload them.

The best way is to use the full path from the site URL. ie

<?php include ''?>

Herman Drost is a Certified Internet Webmaster (CIW)
and owner of
Web Site Design, Web Hosting, Web Site Promotion

Author of “Marketing Tips” newsletter. To subscribe, enter your information at:    (240) 334-3271

[ Design ] [ Hosting ] [ Promotion ] [ Articles  ] [ Portfolio ]

Copyright © 2001-2006  All Rights Reserved