Presentation is loading. Please wait.

Presentation is loading. Please wait.

NMD202 Web Scripting Week1. Contact Information – Lecturer is a part time member of staff. Students are encouraged to use.

Similar presentations


Presentation on theme: "NMD202 Web Scripting Week1. Contact Information – Lecturer is a part time member of staff. Students are encouraged to use."— Presentation transcript:

1 NMD202 Web Scripting Week1

2 Contact Information Email – luis.v.n.silva@gmail.com Lecturer is a part time member of staff. Students are encouraged to use email to make an appointment.

3 Resources Website – to be provided Set Text - Yank, K., C 2007. Build your own Database Driven Website using PHP & MySQL., Sitepoint, Collingwood, Victoria Recommended Text - Valade, J.;C 2006. PHP and MySQL, Your Visual Blueprint for Creating Dynamic, Database-driven Web Sites. Hungry Minds Inc, U.S.

4 Schedule DurationTopics Week 1 ( Jul 25) PHP Syntax Week 2 (July 31) PHP Operators, expressions, constructs Week 3 (Aug 7) PHP Forms, server validation, email Week 4 (Aug 14) MySql Concepts Week 5 ( Aug 21) Handling Databases PHP Week 6 (Aug 28) File and IO operations String manipulation Week 7 (Sep 4) MVC Patterns PHP Week 8 (Sep 18) Session and Cookies Week 9 (Sep 25) PHP & Ajax Week 10 (Oct 2) Libraries Week 11 (Oct 9) Object Oriented PHP Week 12 (Oct 16) Exam

5 ItemFocus Valu e DeliverablesDue Date Prac Exercises Code Exercises (Week1- Week4) 10% Series of exercises Week 4 Assignment Dynamic Web Site 50%  Project Brief  Data Model  Prototype  Working System  Presentation Class  Week 5  Week 8  Week 11 Exam40%3 hour paper Assessment

6 Code Testing Cross browser compatibility Validate against the standards Web Best Practices

7 What we will cover today What is Server Side Scripting History of PHP Syntax Examples and Exercises

8 What is Server Side Scripting Server side scripting refers to operations (scripts) that are executed on the server before feeding information to the browser Examples: ASP, PHP, Java Servlets, JSP, CGI, etc

9 What is PHP Stands for Hypertext Preprocessor General Purpose Scripting language. Usually runs in a Web server Initially interpreted, compiled after PHP4 Loosely-typed (does not do type checks) Procedural or Object Oriented (you choose) PHP is case-sensitive

10 History of PHP Started 1994 as a set of CGI binaries written in C First Release 1995 PHP v2 PHP v3 1997, Parser has been rewrote PHP v4 2004, Zend Engine, compiler PHP v5 2008, Object Support

11 PHP The best feature PHP – Flexibility The worst feature PHP - Flexibility

12 Basic Syntax PHP only parses code within its delimiters: Or

13 Basic Syntax <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> Hello World

14 Exercise Setup Development Environment Do the Hello World example

15 Basic Syntax Operators > Bigger than < Smaller than == Equal === Equal type =! Different ? Ternary ++ Increment -- Decrement && And || or

16 Basic Syntax Variables Variables are prefixed with a dollar symbol and a type does not need to be specified in advance

17 Basic Syntax Variables $x = 1; $y = 2; $z= x+y; echo z; $x = “Hello”; $y = “World”; $z= x.” “.y; echo z;

18 Basic Syntax Loops for ($n=0;$n<5;$n++){ echo $n; } while (condition) do something } foreach ($array as $key){ echo $key; }

19 Basic Syntax Conditional Structures If (condition) { do something } else { do something else }

20 Basic Syntax Conditional Structures switch (variable){ case x: do something break; ….. }

21 Basic Syntax Arrays $a = array(); $a[0]=1; $a[1]=12; $a = array(); $a[‘car1’]=‘red’; $a[‘car2’]=‘green’;

22 Basic Syntax Functions function show($a){ echo ($a); } show(12); function sum($a,$b=20){ return ($a+$b) } echo sum(1); echo sum(1,5);

23 Basic Syntax Native Functions http://www.php.net/quickref.php PHP has hundreds of base functions and thousands more from extensions Google and PHP Manual are the developer’s best friends

24 Debugging PHP Using echo Using die() Using print_r Using debuggers (http://www.easyeclipse.org/site/plugins/p hpeclipse.html)

25 Exercises Display all even numbers between 0 and 6 using an echo statement Write a function that compares two numbers and echos which one is bigger Load an array with numbers and iterate through them echoing which numbers are odd or even, use the foreach iterator Write a function that returns the current date with the full textual representation of the month ie: 12 January 2008


Download ppt "NMD202 Web Scripting Week1. Contact Information – Lecturer is a part time member of staff. Students are encouraged to use."

Similar presentations


Ads by Google