Fred Black pqInternet E-Mail Signup

Insert your name and e-mail address to receive a short notice each time I make a new post.

First Name:

Last Name:

E-Mail Address:

E-Mail again:

NOTE: You will receive a confirmation email. You must click the link in the email to subscribe. Please check your spam folder(s) if you don't receive the email.

*I value your privacy and will never sell, rent, giveaway, or abuse your information.

 

Internet Marketing, Internet Business, Make Money Online, Work from Home

Internet Business and Marketing

pqInternet.com

About Fred W. Black.

Fred W. Black

Link to Me!

How to Link to this Blog.

Categories

All

ClickBank

Copywriting

Funny

Internet Business

Internet Marketing

Life & Law of Attraction

Search Engines: SEO

Technology

Traffic

Truth and Freedom

Web Site Design, HTML, CSS

Recent Entries

Marketing Lesson from the Homeless...

When Good CSS Goes Bad

The Honest-to-God, Unvarnished Truth About Success

Are you Fishing with Bird Seed?

Why Do Smart People Sometimes Find Success So Difficult?

Using My Software to Determine Why a Site Ranks Poorly in Google

Toilet Paper Millionaire!

Freds Inverse Law of Marketing Intelligence (the cream, as well as, the crap rises to the top)

Are You Failing Miserably or Miserably Failing?

Know Yourself

Are You Putting Cash in the Trash?

Behind Bars: Could the New FTC CAN-SPAM Rules Land You In JAIL?

Who Cares?

SEO: Number 1 and Number 2

Beyond SEO - The Tale of the Three Legged Dog

All Entries

Recently Commented On

The Honest-to-God, Unvarnished Truth About Success

Marketing Lesson from the Homeless...

Who Cares?

Build It and They Will Come...

When Good CSS Goes Bad

Using My Software to Determine Why a Site Ranks Poorly in Google

Toilet Paper Millionaire!

Are you Fishing with Bird Seed?

Archives

All

Say No to the
No Follow Tag

Books & Things.


 


 


 


 

« Previous | Home | Next »

 

Understanding Include Files

March 27, 2007

One of the things I cover in my course Introduction to Web Site Creation is using include files to build web pages. An include file is a file that's called or included from another file. A menu, footer, or header is a good example. If your menu, footer, or header is the same on each page of your web site, instead of repeating that section of code on each page, why not have just ONE file for the menu, and one file for the header, etc. You then reference that file from the main code of your web page and it's included as if its code is part of the main page. The great thing is that when you need to change your menu, footer, or header, you only have one file to edit instead of having to edit all the pages of your web site.

Different scripting/programming languages have different syntax for including files; I'll cover PHP here.

One way to approach the initial creation of a page or web site that uses include files is to create the whole page without the include files, and then cut out the sections of code you want to put in include files. I recommend NotePad+ as a good HTML / Code editor (it's Free!).

For example, let's make a menu with two links in it; put this code in a file called incMenu.php:


Then, from the main page, index.php and/or the other pages in the web site, we'll call or Include incMenu.php. You'll put the following statement in index.php where you would normally have put the contents of the incMenu.php file (the two links in this example):


When someone browsing the Internet requests your web page, your web server's PHP engine processes your index.php file and sees the include statement (require) and gets the incMenu.php file and puts it's content into the output that's sent to the end user. In other words, the server replaces the

statement with the contents of the incMenu.php file on the fly. One thing to keep in mind if your server is a Linux/Unix server, is that capitalzation counts (it does not on Windows based servers). So if you name your include file "incMenu.php", you need to reference it from the main files (index.php for example) with the same letters capitalized, "incmenu.php" will not work, you need to use "incMenu.php".

You can use this same technique for headers, footers, sidebars, etc., any part of a page that gets repeated on multiple pages.

The one down side to using include files is that it's harder to layout and edit your pages because parts of your pages are now in more than one file. However, it can save you a huge amount of time because you only have one file to edit vs. editing every page of your web site.

Want to learn more? Get my courses Introduction to Web Site Creation which covers include files and more, and also Web Site Scripting which covers basic php scripting and forms.

Fred

About the Author

Fred Black is an experienced programmer, web site developer, online business operator, systems integrator, father, husband, musician, and songwriter. Visit his Internet Business Blog at: http://www.pqInternet.com.


Insert your name and e-mail address to receive a short notice each time I make a new post.

First Name:

Last Name:

E-Mail Address:

E-Mail again:

NOTE: You will receive a confirmation email. You must click the link in the email to subscribe. Please check your spam folder(s) if you don't receive the email.



Reddit Add this Article to Onlywire del.icio.us Technorati StumbleUpon Netscape Sphinn Top Blogs

Tip Jar: Leave a Donation

Comments: 0,   TrackBacks: 0.

Posted by Fred on March 27, 2007 | Printer-Friendly

TrackBack: http://www.pqInternet.com/Blog/mt-tb.cgi/34


Assigned Categories: Web Site Design, HTML, CSS


Related Entries:


You may reprint or distribute this article as long as you leave the content and the About the Author resource box at the end intact.

 

 
Comments and TrackBacks 
 

 


Post A Comment









Remember personal info?






Subscribe

Insert your name and e-mail to receive a short notice each time I make a new post.

E-mail Address:

E-mail address again:

First Name:

Last Name:

NOTE: You will receive a confirmation email. You must click the link in the email to subscribe. Please check your spam folder(s) if you don't receive the email.

My Courses & Products

Web Site Creation Course: HTML, CSS, and More... Free!
 

Interactive Web Site Course: PHP, JavaScript, Forms, and More... Free!
 

Make Money Online: Complete Online Business Course... Free!
 

Article Marketing Software.
 

Photo Gallery - pqGallery.com
 

Blue Solar Water Bottles
 

Pretend with Miss Kim.
Children's Creative Movement DVD
Pretend with Miss Kim (my wife) takes children on an imaginary fun time as they learn the basic movements of ballet and dance.

Search


RSS Feeds, etc.

Subscribe to Blog Feed:

RSS Feed
RSS 2.0 Feed for www.pqInternet.com. RSS 2.0 Feed
RSS 1.0 Feed
Add to Google Toolbar

Add www.pqInternet.com, to Google.
Add www.pqInternet.com, to My Yahoo!
Add www.pqInternet.com, to My MSN.
Add www.pqInternet.com, to My AOL.
Subscribe to www.pqInternet.com, with Bloglines
Subscribe to www.pqInternet.com, in NewsGator Online
Subscribe to www.pqInternet.com, in Rojo
Subscribe to www.pqInternet.com, in FeedLounge
Subscribe to www.pqInternet.com, in NetVibes
Add www.pqInternet.com, to Your Technorati Favorites!
Subscribe to www.pqInternet.com in myEarthlink
Add www.pqInternet.com, to Windows Live

What are Blog Feeds and RSS anyway?

Products I Use & Recommend.

www.3WayLinks.Net

Wordtracker Keyword Research Tool

www.aweber.com Opt-In List Management.

1&1 Hosting

Blogroll

Clayton Makepeace

Terry Dean

ProBlogger

Eric Graham

Michel Fortin.com

Jonathan Leger

Robert Phillips

Dr. Joe Vitale

Ryan Healy

Richard Lee

G. Brent Riggs

Search Engine Journal

Links

Cell Phones for Soldiers

the IconFactory

Fred Black Music

Niall Kennedy

The Lions Paw

Web Hosting.

My Recommended Web Hosting Service: 1&1 Hosting

Mugs, Mousepads, etc.

About this Blog

By:Fred W. Black

Contact Information

Powered by:Movable Type 3.34.

Copyright 2006 -2008, PhaseQuest.Com.
All rights reserved.

Resources L2

Some photos are by: Lee Hinshaw Photography

© Copyright 2006 - 2008 PhaseQuest, all rights reserved.