Hunter Network . Free Templates . Free Graphics . Web Hosting Directory . Top Template Sites . Web Design Directory

Partially Dynamic Website Creation

| Main | Template Blog | Top Site | Template Search Engine | Webmaster Resources | Video Turtorials | Site Map |

Template Offers
7,500 + Templates
osCommerce Templates
Template Membership
100's of Templates
Dreamweaver Templates
Free Web Templates
CategoryeCommerce Templates(2)
CategoryFree Business Templates(4)
CategoryFree Portal Templates(1)
Main Menu
Free Templates Home
Blog Templates
Dreamweaver Templates
Flash Templates
Logo Templates
Mambo Templates
Swish Templates
Buy Web Templates
View All Templates
Video Tutorials
Webmaster Articles
Write for Us
Advertise
Download Our Toolbar
Contact Us
Search
Link to Us
Webmaster Resources
Webmaster Feeds

Free Templates Home arrow Webmaster Articles arrow Programming arrow Partially Dynamic Website Creation

Template Blog


Partially Dynamic Website Creation PDF Print E-mail
Written by Adem   

Using php include files

If you are looking for a way to benefit from a dynamic site without the hassle of a lot of programming use php include files. So what are PHP include files? PHP includes are simple commands that will pull a file into your content where ever you place the code. The reason for doing this is so that you can make site wide changes to your site by editing your included files instead of editing the same thing on every page. Template Hunter is made up of over 250 pages. If I need to make a change in the left column I make it in one place, and it affects the whole site.

Note: for PHP include files to work you must name your pages as yourpage.php or you can use a .htaccess file to interpret .html pages as .php Here is the code you will need for that .htaccess file

AddType application/x-httpd-php .php .htm .html
php_flag register_globals on
php_flag magic_quotes_gpc on

Just place that code on a page and name it .htaccess then upload it to your server. This will allow the PHP includes to work with .html pages.

Example:
The Template Hunter site is created with HTML pages and PHP includes. How you ask...well the site design is layed out in blocks

1. network.html makes up the very top are of the links to our network sites
<?php include("http://www.templatehunter.com/network.html"); ?>

2. navleft.html makes up all the left column of navigation
<?php include("http://www.templatehunter.com/nav.html"); ?>

3. navright.html makes up the right column
<?php include("http://www.templatehunter.com/rt_nav.html"); ?>

4. footer.html makes up the resources links at the bottom of the page.
<?php include("http://www.templatehunter.com/footer.html"); ?>

Each of these areas are pulled into their respective blocks using PHP includes.

This is what the page looks like in my editor.

Let's dicect this code.

<?php include("http://www.templatehunter.com/footer.html"); ?>

I have placed this in the lower cell of the page, and when called it places the footer.html page into it.

When you are making your include files (footer.html) be sure to remove all the extranious code from the body tag up, and from the close body tag down to the close html tag. It is not needed. Be sure to make everything an absolute path like your links, images and such in each include file. This will help you if you have other folders that use that include file. Now just make your blocks of code use the PHP includes and you are on your way to easy maintenance.

 

Related Items

Tools
Bookmark Website
Bookmark Page
Make homepage
Print Page
Most Recent

Popular

Advertisement

Webmaster Tip
Use a linked CSS (cascading style sheet) for formating to make site wide changes easy.
 
Advertise on Template Hunter
Login Form





Lost Password?
No account yet? Register
Who's Online
We have 4 guests online

Template Tuning
Web Design Helper

Web Hosting

Co-located Hosting

ColdFusion Hosting

Dedicated Hosting

E-Commerce Hosting

Frontpage Hosting

Managed Hosting

Reseller Web Hosting

Unix / Linux Web Hosting

Virtual Private Servers

Windows Hosting

© 2002-2007 Template Hunter


Las Vegas Web Design
Las Vegas Web Hosting

Resources