![]()     |
||
News
Profile Sections HTML JavaScript CSS ASP PHP |
PHP Tutorial 1 - An Introduction This isnt exactly getting deep into php, tutorial number 1 will be a dasic intro, and how it works.
PHP, firstly, strangely stands for: PHP: Hypertext Protocall. Hmmm. yes, like i said, strange. Anyhow. PHP is a widely used script, and its relitavely easy. Ive been doing little bits over the past 4 months, and ive got far, as im now working on some dummy proof scripts. PHP is a server side script, so theres no compatibilties between different users, just the server you're on. But, luckily, this doesnt make much difference, as they all tend to have the latest version. More info on php can be found at www.php.net Right, lets get onto basics of coding: First, you need note pad, and a system with php on (like you will have that!) or, a server with php on, and ftp proggy to get them there. A php document, without its php "tags" will be counted as text, or html code by your browser. The code wont be processed by php. The tags, are <? to open PHP, and ?> to close PHP. <?php can also be used to open php. but that does squat more. A basic function, one that you will need for later dates is the phpinfo() function. All this does, is get all your php info off the server, and make some nice tables from it. An example where is this is used, is here: http://fs.settlers4.net/phpinfo This function us extremely basic, so its good to start with it. Lets make a script, that will display phpinfo() for us. We will have to open with <? and ?> like said eariler. Simply, to execute the phpinfo function, we simply insert phpinfo() however, thats not all. at the end of each function, a ";" will need to be added. This is like a full stop or comma in php terms. It says thats the end of a function, and the start of a new one, so lets see what the php code looks like: <? phpinfo(); ?> This, will make your server's equivalent of http://fs.settlers4.net/phpinfo All data there will be different. But, this will indicate the limitations you have for future scripting. For example, there at the top is a variable called "allow_url_fopen". On mine, its set to one - True. This means that the fopen() function using a url will function. the fopen() function, basically does what your brower does when you type in yahoo.com, as such. What it actually does it return true or false. True if it opens the page, and false... you can guess. Such a function would be a url checker, to see if it is valid. Another note: if you miss a ";" or any fault in the code, the script simply wont execute, and will return a parse error. Thankfuly, for long scripts, it gives the line number in question. At the basics, its easy to sort. But when you're in big scripts, it can be caused by leaving quotes open, or brackets. Next one will be some useful functions |
Fan Sites Is Settlers becoming like AOE?
|
| © Copyright Matthew Strahan BlueByte, Settlers, Ubisoft are registered trademarks of Ubisoft Entertainment DO NOT DISTRIBUTE COMMERCIALLY |