PHP Introduction and IncludesExample: None
Requirements: PHP enabled host
Previous Knowledge: No previous knowledge required
Introduction: If you feel that HTML is restricting your creativity or from expanding your website, then it's time to graduate to PHP. PHP makes coding a WHOLE lot easier and more fun.
There are many ways that PHP could be used for. However, the file extension where the PHP script is to be embedded HAS to be either in .php, .phtml, .php3, or .php4 for it to work. You would have already heard of .php from other websites, and of .phtml from neopets.
If you insert a PHP script into a file that reads index.html, it wouldn't work. It would work, however, in a file that reads index.php. BUT PHP could be embedded into HTML coding. It's important that you understand this before we go on. If you don't understand, read the paragraph again until you do.
The most popular use and the easiest to grasp is the PHP include. That is, an external file with a php extension or .txt is "included" inside another php page no matter where that external file may be. I'll explain this further later on, but for now think of php inclusions as frame coding, but minus the hassle.
However, understand now while it's still early that you CANNOT include a domain eg. http://www.geocities.com/123. You can only include files WITHIN your directory.
I know of four ways in which PHP could be written:
1. <?php ?>
Now I tend to use #1, <?php ?> because this is the universal coding. It works on any website with PHP installed. In some cases the other three doesn't work on some servers. So for the sake of this tutorial I will be referring to <?php ?>. Once you're comfortable with PHP, you may start experimenting with the other three.
|Fragiled Arts © 2005-2006 Victoria Galang. All Rights Reserved.|