Code It All.com

Menu

Home
Help Forum
CIA Topsite

Getting Started
HTML Tags
Links
Graphics
Text
Display Your Code
Site Formatting
CSS

PHP
   - What is PHP?
   - Why Use PHP?
   - How to Use PHP

Javascript
Guestbooks / Shoutbox
Lists
E-mail
Extras
Site Tips

Tools

Color Chart
Scrollbar Gen
ASCII Chart
HTML Cheat Sheet
MySpace Ad Remover
Xanga Ad Remover

Contact Me





Site Links

- MySpace Icons
- Your link here
- More Affiliates...

PHP

While php is a rather complicated topic I'm going to do my best to teach you the most basic and useful php technique.  Sorry there's not more here but check out the forum for more help.  Please note that in order to have the following code work the files must be .php files and the server must be set to be able to handle php.

What is PHP?

PHP is a different form of HTML in which code is read and compiled as the visitor arrives at the page.

 Top



Why use PHP?

PHP, like CSS allows you to change multiple areas in a relatively easy way.  This page for example utilizes php include statements which tell the page to go and gather information from other pages on the server.

 Top



How do I use PHP?

Well first things first, you must be certain that php is enabled on the server you purchased.  If you need assistance checking for this contact the support of your server provider.

<?php include("includes/Footer.php"); ?>

This is a code copied directly from part of my site.  Unfortunately you would be unable to find it because that changes into the code that is on the Footer.php file.  This include statement appears on every page of this website and produces the same footer on every page.

The cool thing about using this is that now if I needed to add something to the footer of every page I could simply change Footer.php and all of them would change instantly.  Pretty cool hu?

 Top



Making your own Example

I apologize for the lack of example here but it's extremely difficult to show the example.  You will just have to try it out yourself.  Just open your HTML editor and create a page with some text, any text doesn't even need to be code.  Upload that to your server call it example.php then create main.php and place the code

<?php include("example.php"); ?>

If you place both example.php and main.php in the same folder on your server and you visit main.php and attempt to view source (right click the page go to view source).  You will notice the code on the page is just the text you placed in example.php.  You won't see the include code at all.  That's how it works.

 Top
Code It All - Copyright 2008
users online

Valid HTML 4.01 Transitional