21
ITD 3194 Web Application Development Chapter 4: Web Programming Language

ITD 3194 Web Application Development

  • Upload
    norton

  • View
    23

  • Download
    0

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Page 1: ITD 3194 Web Application Development

ITD 3194Web Application Development

Chapter 4: Web Programming Language

Page 2: ITD 3194 Web Application Development

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??

Page 3: ITD 3194 Web Application Development

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.

Page 4: ITD 3194 Web Application Development

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.

Page 5: ITD 3194 Web Application Development

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

Page 6: ITD 3194 Web Application Development

Brief History of PHPPHP (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.

Page 7: ITD 3194 Web Application Development

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".

Page 8: ITD 3194 Web Application Development

Example<html>   <head>       <title>Example</title>   </head>   <body>

       <?php        echo "Hi, I'm a PHP script!";        ?>

   </body></html>

Page 9: ITD 3194 Web Application Development

Different type of Tag (Open and Close)

Starting tag Ending tag Notes

<?php ?> Preferred method as it allows the use of PHP with XHTML

<? ?> Not recommended. Easier to type, but has to be enabled and may conflict with XML

<script language="php"> ?> Always available, best if used when FrontPage is the HTML editor

<% %> Not recommended. ASP tags support was added in 3.0.4

Page 10: ITD 3194 Web Application Development

Getting Started

Simple HTML Page with PHPThe following is a basic example to

output text usingPHP.

<html><head><title>My First PHP Page</title></head><body><?phpecho "Hello World!";?></body></html>

Page 11: ITD 3194 Web Application Development

Getting Started

Using conditional statementsConditional 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.

Page 12: ITD 3194 Web Application Development

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 maintenancePage 1Content

Page 5Content

Page 3Content

Page 2Content

Page 4Content

Header

Footer

Page 13: ITD 3194 Web Application Development

Comments in PHP

• Can use 2 type of notation: – /* your block comment start here */– //line comment

What is the purpose of comment

Page 14: ITD 3194 Web Application Development

Declaring and initializing variable

• $variable_name=value;

• Display variable– Use echo $variable_name;

Page 15: ITD 3194 Web Application Development

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

Page 16: ITD 3194 Web Application Development

Building Expression

• Arithmetic Operator:$x=10; $y=20;$z = $x + $y;

Page 17: ITD 3194 Web Application Development

Building Expression

• Assignment Operator = -= /=+= *=

• Comparison Operator– == > >=– != < <=

Page 18: ITD 3194 Web Application Development

Building Expression

• Logical Operator– &&– ||– !

Page 19: ITD 3194 Web Application Development

Function

DEFINING FUNCTION

<?php function name_of_function(parameter){ statement; }

?>

Page 20: ITD 3194 Web Application Development

Function

• Calling Functionname_of _function(parameter_value);

Page 21: ITD 3194 Web Application Development

THANKS FOR LISTENING WITHOUT SLEEPING

Take Risks in Your Life"If u Win, U Can Lead!If u Loose, U Can Guide!