Presentation is loading. Please wait.

Presentation is loading. Please wait.

* Lecture # 7 Instructor: Rida Noor Department of Computer Science

Similar presentations


Presentation on theme: "* Lecture # 7 Instructor: Rida Noor Department of Computer Science"— Presentation transcript:

1 * Lecture # 7 Instructor: Rida Noor Department of Computer Science
07/16/96 Web Design and Development Lecture # 7 Instructor: Rida Noor Department of Computer Science (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

2 Working on Dreamweaver
* 07/16/96 Working on Dreamweaver Open Dreamweaver (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

3 Working on Dreamweaver
* 07/16/96 Open Dreamweaver. Create new HTML page. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

4 Working on Dreamweaver
* 07/16/96 Here is the code view of HTML page. Where you can write HTML code (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

5 Working on Dreamweaver
* 07/16/96 Here is the design view of HTML page. Where you can drag and drop contents. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

6 Working on Dreamweaver
* 07/16/96 You can change properties from attributes pannel and bottom pannel as shown below. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

7 Working on Dreamweaver
* 07/16/96 Here is the split view of HTML page. Where you can code and design on same screen. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

8 Designing FORM From insert tab you can insert form and fields. *
07/16/96 From insert tab you can insert form and fields. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

9 Designing FORM * 07/16/96 To see your page in browser save it as C:/wamp/www/myWebsite/loginForm.html Click on preview in chrome from dreamwaever. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

10 Designing FORM Your designed page appears like this in browser. *
07/16/96 Your designed page appears like this in browser. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

11 Starting with PHP Click on new from File menu. * 07/16/96
(c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

12 * Starting with PHP 07/16/96 Select Dynamic category and then select PHP from dynamic page options and press create. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

13 * 07/16/96 Starting with PHP A php page will be created and save it as C:/wamp/www/myWebsite/login.php. If you are using XAMPP then your path will be C:/xampp/htdocs/myWebsite/login.php. Once you page is created, you can write PHP code here. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

14 What is PHP? PHP stands for PHP: Hypertext Preprocessor
* What is PHP? 07/16/96 PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language PHP scripts are executed on the server PHP files may contain text, HTML tags and scripts. PHP files are returned to the browser as plain HTML. PHP files have a file extension of ".php", ".php3", or ".phtml". (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

15 What is PHP? PHP can be written in any text editor.
* 07/16/96 What is PHP? PHP can be written in any text editor. PHP script will be located inside special tags, much like JavaScript e.g. <?php //php script here ?> PHP code can be located any where in the page. PHP is case sensitive. Every variable in PHP will have the $ symbol as a prefix e.g. $myName =“John”; (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

16 Why PHP? PHP runs on different platforms (Windows, Linux, Unix, etc.)
* 07/16/96 Why PHP? PHP runs on different platforms (Windows, Linux, Unix, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP is easy to learn and runs efficiently on the server side (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

17 * 07/16/96 Basic PHP Syntax A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code. Below, we have an example of a simple PHP script which sends the text "Hello World" to the browser: <html> <body> <?php echo "Hello World"; ?> </body> </html> (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

18 Basic PHP Syntax Each code line in PHP must end with a semicolon.
* 07/16/96 Basic PHP Syntax Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another. There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World". (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

19 PHP First Code Create new PHP page . Go to File menu.
* 07/16/96 PHP First Code Create new PHP page . Go to File menu. Name your firstPHP.php. save it as in C:/wamp/www/PHP/firstPHP.php or C:/xampp/htdocs/PHP/firstPHP.php Start services on WAMP/XAMPP. Type localhost/PHP in browser. Select your php page in browser i.e firstPHP.php(It will be blank in start) (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

20 PHP First Code Write following code in your php page on Dreamweaver.
* PHP First Code 07/16/96 Write following code in your php page on Dreamweaver. Refresh your URL in browser that is (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

21 PHP First Code See Hello World! would print in browser. * 07/16/96
(c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

22 * 07/16/96 Comments In PHP In PHP, we use // to make a single-line comment or /* and */ to make a large comment block. <html> <body> <?php //This is a comment /* This is a comment block */ ?> </body> </html> (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

23 PHP Variables * 07/16/96 Variables are used for storing a values, like text strings, numbers or arrays. When a variable is set it can be used over and over again in your script All variables in PHP start with a $ sign symbol. The correct way of setting a variable in PHP: <?php $var_name = value; ?> (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

24 * 07/16/96 PHP Variables New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work. Let's try creating a variable with a string, and a variable with a number: (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

25 PHP Variables * 07/16/96 (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

26 PHP Variables and html tag
* 07/16/96 If you want to add break tag in your code then close php tag. Add <br/> and start new php tag again. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

27 * 07/16/96 Variable Naming Rules A variable name must start with a letter or an underscore "_" A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ ) A variable name should not contain spaces. If a variable name is more than one word, it should be separated with underscore ($my_string) or with capitalization ($myString) (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

28 The Concatenation Operator
* 07/16/96 There is only one string operator in PHP. The concatenation operator (.) is used to put two string values together. To concatenate two variables together, use the dot (.) operator: (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

29 The Concatenation Operator
* 07/16/96 (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

30 Using the strlen() function
* 07/16/96 The strlen() function is used to find the length of a string. Let's find the length of our string "Hello world!": (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

31 Using the strpos() function
* 07/16/96 The strpos() function is used to search for a string or character within a string. If a match is found in the string, this function will return the position of the first match. If no match is found, it will return FALSE. Let's see if we can find the string "world" in our string: (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

32 Using the strpos() function
* 07/16/96 As you see the position of the string "world" in our string is position 6. The reason that it is 6, and not 7, is that the first position in the string is 0, and not 1. (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*


Download ppt "* Lecture # 7 Instructor: Rida Noor Department of Computer Science"

Similar presentations


Ads by Google