You Here? APPLY! DesiredSuperStar EveryHeartbeat Mesilan Gorgeous-Failure Oh-Sassy Alias Loz <3 Frutee Fishee

PHP Includes



Notice .php extensions on pages on most websites? Now you can construct your own pages with PHP! It's way efficient and easier!

Question:

What is PHP?
PHP is Hypertext Processor, a new, simpler form of codes created by Rasmus Lerdorf.

Question:

What is a PHP include?
PHP include is a PHP script that allows one page to be included in a particular page. This is useful among websites today as PHP include enables people to include their layout & footer at once, so that they don't have to copy paste long codes in each pages, and so that it is easy to modify later when a layout is changed.

Question:

How do you put PHP includes in your site?
1. Open Notepad/text editor or whatever you want.

2. Create your layout in this notepad document. For example:
<head>
<title>My Site.</title>
Etcetera... This is just an example so that you get what I mean. After you've coded your layout, save your notepad document as header.php. Don't forget the ".php" extension!

3. Make a new document on Notepad. This time, create your footer. For example:
<center>© You 2007. No copying.</center>
You can put anything you want for the footer... most people put their copyright / disclaimer but it's up to you. Save the notepad document as footer.php. Don't forget the ".php" extension!

4. Make a new document on Notepad. For example this is your "about me" page. This is where the PHP includes work. First, copy and paste this code on top of your new document on notepad.
< ? php include (" header.php") ; ?>
No spaces between the "<" and "?"
No spaces between "include" and "("
No spaces between ")" and ";"

5. After you paste that code on your new notepad document, afterward below it put the content of your about me page. For example:
My name is Blabla, I like to design, etc.
When you're done putting the content of the page below the PHP script, below the content of the page you have typed you copy and paste:
< ? php include (" footer.php") ; ?>
No spaces between the "<" and "?"
No spaces between "include" and "("
No spaces between ")" and ";"
If that was your about me page, save it as "aboutme.php" Don't forget the ".php" extension!

6. VOILA! Done. It's okay if you don't get it the first time you read it. It happened to me too. But when you're used to it, and you follow these instructions with practice, you can do it! :)