Presentation is loading. Please wait.

Presentation is loading. Please wait.

PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database.

Similar presentations


Presentation on theme: "PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database."— Presentation transcript:

1 PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database.

2 Update (Oct 2013): change of server name Please note the server name is no longer rm4ftp but is now ictweb E.g. wherever you see the server address rm4ftp, use ictweb instead, e.g. http://rm4ftp/php/helloworld.php change to: http://ictweb/php/helloworld.php

3 PHP – open and closing tags <? = opening tag ?> = closing tag <?php php code in here ?> Option 2 – only use if web server enabled to recognise this <? = opening tag ?> = closing tag <? php code in here ?> Option 1 – safest – this is the standard format. Note the mirror symmetry.

4 PHP PHP can be included directly within the HTML source code itself. Save the file with the.php extension and upload it to a PHP enabled web server (check with your host) In the example opposite, the page was uploaded to a local intranet testing server and opened in Internet Explorer (link below to try) helloworld.php Create source code Save with.php extension, upload to web server Open page in browser using the web URL for the page Notice the web server has “parsed” the PHP script before sending it to web browser (right click > view source) OUTPUT

5 PHP PHP may be separately coded without additional HTML (i.e. without the,,, etc.), and opened in a web browser Save the file with the.php extension and upload it to a PHP enabled web server (check with your host). Link to example, below: helloworld2.php Create source code Save with.php extension, upload to web server Open page in browser using the web URL for the page OUTPUT

6 PHP – default home page The default name for a home page is normally “index” (e.g. index.html). E.g. save the page below as index.php then upload to web server. Enter website address, in the example opposite this is the local intranet testing server

7 PHP Info Create a page with the code shown opposite. Save the page as phpinfo.php Upload the file to the server phpinfo.php The phpinfo() function outputs server information. For security, only use this temporarily, remove it afterwards

8 include The page opposite was created using 3 files: include.php header.html footer.html These are uploaded to the PHP enabled web server. Here is the final page: include.php header.html footer.html

9 include Here are the 3 web pages shown separately: header.html (top) include.php (middle) footer.html (bottom) Common elements such as the header and footer can be created as separate files then combined using the include statement

10 include Here is an example of the source code for combining other web pages using the include statement. header.html footer.html

11 echo Echo is a “language construct” that looks like a function. It allows more than one value to be output to screen (printed). Examples <?php echo "This is a better place "; echo ("This is a better place"); echo ("This is a better place"); ?>

12 php.net PHP can be downloaded and installed easily, and is freely available There is also a lot of support for PHP

13 WAMP “Windows Apache MySQL PHP” (WAMP Server) Allows you to create a testing server on your own PC and configure the server to run PHP and MySQP. Alternatives web servers include MAMP (Mac), LAMP (Linux) and XAMPP

14 sourceforge.net WampServer is a Windows web development environment. It allows you to create web applications with Apache2, PHP and a MySQL database. WAMP can be installed by searching for a reputable source to download from, e.g. sourceforge.net url: http://localhost


Download ppt "PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database."

Similar presentations


Ads by Google