Chapter 1: Overview |
|
How to use this book |
|
|
I'm pretty sure you're going to skip around in this book, at least at first. So, there are several places where topics are repeated, discussed in more detail or you're referred back to another chapter. This is your book now; use it to your best advantage. Bounce around, read it straight through or whatever works best for you. I've tried to make it as easy as possible for all types of readers. First, read Chapters 2, 3 and 5. This will give you a good understanding of what PHP is and help you determine whether you can use it on your Web site. If you find that there is a problem with your host which will prevent you from using PHP, seriously consider changing to a different host. Many free sites, as well as some very low-priced hosts, will not let you run PHP scripts. If this is the case, please refer to Appendix B for some hosting companies that will give you more power and flexibility. Keep in mind that some scripts are going to be difficult to install if your host does not allow you enough control. |
|
If you did not find any of the limitations mentioned in the last paragraph, that's great! Now, read Chapter 6 to get a grasp of what's involved in installing scripts. As you go through this crucial area, I'll guide you every step of the way. Great care has been taken to present the tools and concepts in a logical order. If you find that you are sufficiently familiar with the contents of a section, feel free to skip ahead. I do suggest that you do everything in the order I've presented it, because you'll encounter far less trouble that way. Now decide what task you want to accomplish with a script. If what you want can be done by one of the complete scripts provided here, you are in luck. See the next paragraph; it will tell you how to pull out that script and get started. For any of the complete scripts, simply copy and paste all the code into a new text file. Save it with a name of your choice and a .php extension. I use EditPlus 2 for this purpose, but any text editor will do. Don't use a word processor (such as Microsoft Word, for example). Word processors insert invisible (non-printing) characters for formatting which will corrupt your script. If you didn't see a script that does exactly what you want among the ones included here - don't worry. There are loads of PHP scripts free for the taking on a number of Web sites. Chapter 4 will show you a lot of places to shop for free scripts. Some will also have scripts for sale. In a few cases, you'll come across a script (usually a very complex one) that requires a monthly or yearly payment for using it. Often, such scripts reside on the owner's server, and you merely call them with a few lines of your own code. My advice is simple: If you can find a free script that does the job...use it. If not, consider putting together a script of your own. I'll show you how to do that. You can use one or more of the functions included here to build a new script or add features to an existing one. If you aren't comfortable with the job of composing a new script, search around for a paid one that meets your needs and buy it. |
|
|
|
For functions, copy and paste them into some existing script or a new one you are starting. Be absolutely sure that you get the closing "}" character of the function, or they won't work! If you buy a script, you can install it yourself in most cases. Take your time, read all the instructions and do exactly what they say. You may have to edit a line here and there to customize the script. After you've read Chapters 6 and 7, you'll see that this is really pretty easy. If you are going to write (or at least piece together) some scripts of your own, you'll want to read Chapters 8 through 17. Feel free to skip any sections that you don't need for your current project. You can come back later when you need to learn what they can teach you. If you stop at Chapter 7 and come back later, be sure to at least skim Chapter 7 and review the mechanics of writing a script. As with many skills, you may have forgotten something if you haven't used it for a while. There will be times when you just want to modify an existing script. Perhaps you want to add a feature or change the way something works. In Chapter 12, you'll discover how to work with functions. This comes in handy for adding one or more features to an existing script. You can often find a function that provides just the feature you want to add. |
Notations used in this book: |
|
Note: These items contain extra information about the current topic. They may help you avoid pitfalls and increase your understanding of the material. Tip: These items offer shortcuts, time-savers and clever tricks you can use. function(Argument1, Argument2, etc.) This is a generic way of showing you how a function call looks. Argument1 and Argument2 will usually be actual variables in your script. Sometimes they will be actual values. Be careful with real values! If they aren't numbers, put them in double-quotes. The words I'll use as "arguments" will usually give you clues about what sort of data will be in the variables or values. Here's an example: file("filename"); The string "filename" is the only argument passed to the file( ) function. I used the word "filename" so you'd see that the argument should be the name of a file. When you actually put the function call in a script, it will look like: file("MyLogFile.txt"); OR file($file); What's the difference between these two examples? The first one is passing the real filename (MyLogFile.txt) to file(). The second one is passing in the variable $file. |
| Previous Page Table of Contents Next Page |
Copyright © 2004 Steve Humphrey |