VisageHosting.com
 
Home
 
Resources
- PHP and MySQL (2)
- HTML and CSS (0)
- CGI and Perl (0)
- Java (0)
- JavaScript (1)
- Python (0)
- ASP (1)
- Web Hosting/Servers (14)
 
Articles
- PHP/MySQL (11)
- HTML/CSS (5)
- Other Languages (4)
- Web Hosting (2)
- Computer Tech (7)
 
Forum
 
 
Register
Login

Username:

Password:

 
 
Currently 0 registered users and 4 guests browsing.

29 articles available for viewing.

1313399 total page hits.

Welcome to our newest registered user, choonchan!


PHP/MySQL -> Tutorials



How to Use Includes in PHP

- by northofnowhere on 05/23/06, 8:49PM CEST (3270 Views)



One of the first great concepts to learn in PHP is an include. It allows a very simple way to include a header and footer (or other items) on every page, or selected pages. In the future when your site has updates to be done to the header or such of the pages, you will only need to update one page, instead of every page. This is a great timesaver and has a multitude of purposes.

Steps:
1) Create a basic php index page named index.php


Code:
<?php include("menu.inc"); ?>
<p>This is my website!</p>
</body>
</html>


2) Create your include file named head.inc


Code:
<html><body>
<a href="index.php">Main Page</a> -
<a href="about.php">Who We Are</a> -
<a href="links.php">Favorite Links</a> -
<a href="contact.php">Contact Us</a>


3) Upload to server, to edit your header simply edit the head.inc page from now on. Simple and easy.

4) Copy the include script from index.php to all relevant pages you would like your header to show in. This can be done for footers or any other information you wish to appear on multiple pages.

Notes:
The include file may be names anything you with and end in many extensions such as .txt, .inc, .abc, .php.


Seen this article somewhere else? Report it for plagiarism!

Noticed an error in this article? Tell us what's wrong!

View Comments for this Article

Related Articles

- Uncluttering Your PC (or How To Remove Useless Stuff From Startup)
Rating

3.00/5

2 Votes

Want to rate this article? Register a free account or Login if you already have one.


Comments

Comment by choonchan on 08/11/10, 7:09AM CEST

hDXU5L [a href="http://yxdrhdwnwfcq.com/"]yxdrhdwnwfcq[/a], [url=http://kknwsmgjurdo.com/]kknwsmgjurdo[/url], [link=http://kovjgpzittki.com/]kovjgpzittki[/link], http://nvdppzgmtpct.com/

Comment by lymanknap on 08/05/10, 12:47AM CEST

aoFRig [a href="http://qziqbprzuqnz.com/"]qziqbprzuqnz[/a], [url=http://ljabcuruicfw.com/]ljabcuruicfw[/url], [link=http://szczindkubbj.com/]szczindkubbj[/link], http://dyyzeenhkutc.com/



Want to add a comment? Register a free account or Login if you already have one.



All content on this site is property of www.juxtaposing.com. Do not copy anything on this site without prior written permission of the site owner.