210 likes | 306 Views
ITD 3194 Web Application Development. Chapter 4: Web Programming Language. Introduction to Web Programming. Web programming is used to build: web pages web sites web applications Do you know what is the difference between these three??. Web Page.
E N D
ITD 3194Web Application Development Chapter 4: Web Programming Language
Introduction to Web Programming Web programming is used to build: • web pages • web sites • web applications Do you know what is the difference between these three??
Web Page A document containing text and graphics created with HTML that is part of a group of hypertext documents or resources that can be accessed through a web browser on the internet.
Web Site A collection of related web pages found at a single address. A URL serves as the top-level address of a Web site and points to that Web site's home page. That page serves as a reference point, containing pointers to additional HTML pages or links to other Web sites.
Web Application A web application is a set of web pages that are generated in response to user requests. The Internet has many different types of web applications, such as - search engines - online stores - auctions - news sites
Brief History of PHP PHP (PHP: Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994. It was initially developed for HTTP usage logging and server-side form generation in Unix. PHP 2 (1995) transformed the language into a Server-side embedded scripting language. Added database support, file uploads, variables, arrays, recursive functions, conditionals, iteration, regular expressions, etc. PHP 3 (1998) added support for ODBC data sources, multiple platform support, email protocols (SNMP,IMAP), and new parser written by Zeev Suraski and Andi Gutmans . PHP 4 (2000) became an independent component of the web server for added efficiency. The parser was renamed the Zend Engine. Many security features were added.
Example Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode".
Example <html> <head> <title>Example</title> </head> <body><?php echo "Hi, I'm a PHP script!"; ?> </body></html>
Getting Started Simple HTML Page with PHP The following is a basic example to output text usingPHP.
Getting Started Using conditional statements Conditional statements are very useful for displaying specific content to the user. The following example shows how to display content according to the day of the week.
Header Page 1 Content Page 2 Content Page 3 Content Page 4 Content Page 5 Content Footer Web structure arrangement Benefits: - Any changes to header or footer only require editing of a single file. This reduces the amount of work necessary for site maintenance and redesign. - Helps separate the content and design for easier maintenance
Comments in PHP • Can use 2 type of notation: • /* your block comment start here */ • //line comment What is the purpose of comment
Declaring and initializing variable • $variable_name=value; • Display variable • Use echo $variable_name;
Data type • Where to put the data type in PHP language • No need to declare the data type of variable • Data type known by looking at the value
Building Expression • Arithmetic Operator: $x=10; $y=20; $z = $x + $y;
Building Expression • Assignment Operator = -= /= += *= • Comparison Operator • == > >= • != < <=
Building Expression • Logical Operator • && • || • !
Function DEFINING FUNCTION <?php function name_of_function(parameter) { statement; } ?>
Function • Calling Function name_of _function(parameter_value);
Take Risks in Your Life"If u Win, U Can Lead!If u Loose, U Can Guide! Thanks FOR LISTENING WITHOUT SLEEPING