Lecturer Details Aonghus Sugrue Website: aonghussugrue.wordpress.com Email: email@example.com@umail.ucc.ie Room 2.110, ORahilly Building, University College Cork
Schedule Week CommencingMonday 1-3pm 03-JanBank Holiday 10-JanIntroduction & Php 17-Jan 24-Jan 31-Jan 07-Feb 14-Feb 21-Feb 28-Feb 07-Mar 14-Mar 21-MarReview Lecture 28-MarStudy Week Continuous Assessment 19 th Feb – Project Part 1 19 th March – Project Part 2
Continuous Assessment 20% of total module grade 2 parts 1.19th Feb – Project Part 1 (10%) 2.19th March – Project Part 2 (10%) Develop a fully functional website with server side scripting and database backend Details to follow in due course!
Term 2 Continue to use these client side technologies but… – Utilise server side technologies – PHP server side scripting and Database WHY??
Client Side Limitations Static webpages Hard to maintain Not easily scalable
Client Side + Server Side Enables dynamic website creation Scalable Enables the use of backend Database
9 Introduction to PHP PHP is a powerful server-side scripting language for creating dynamic and interactive websites PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP PHP is perfectly suited for Web development and can be embedded directly into the HTML code
10 PHP The PHP syntax is very similar to Perl and C PHP is often used together with Apache (web server) on various operating systems making up the what is known as the LAMP server – LAMP = Linux; Apache; MySQL; and PHP – LAMP is a very powerful open source alternative to proprietary web server solutions
11 Serving a PHP file Here are some fun things to do: 1.Go shopping 2.Play soccer URL: www.mypage.com/www.mypage.com/ funstuff.php 3. Receive Request, find file and read it 4. Execute PHP statements 5. Send back results 6. Return Results 2. Send Request for PHP file 1. User enters web address to PHP file 7. Receive and interpret HTML file WEB SERVER Internet – Connect to Web Browser
12 What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.) PHP is an open source software (OSS) PHP is free to download and use
13 What is PHP? It is a server –side scripting language designed for the web. PHP is embedded into HTML and is executed each time the web page is visited. PHP is interpreted by the web server and generates HTML code or other output for the user to see.
14 More on PHP PHP is an open source product. You have access to the source code. You can use it, alter it and redistribute it without charge. PHP originally Personal Home Page, now stands for PHP hypertext preprocessor.
16 Development Environment Server-side scripting - You need three things to make this work. The PHP parser (CGI or server module), a webserver and a web browser. You need to run the webserver, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server.
17 Programming PHP A typical PHP file includes: – HTML – PHP tags – PHP statements – Whitespace – Comments Note When you view the source of an PHP file on the client side you will not see the server side script, all you may view is the HTML generated.
18 PHP Tags <?php echo Order Processed; ?> This is the default tag used for PHP development.
19 Example 1 Example <?php echo "Hi, I'm a PHP script!"; ?>
20 Whitespace Can improve code readability. The addition of white space does not affect the execution of your code. White space makes your PHP file bigger but makes the code more readable.