itd 3194 web application development

Post on 26-Feb-2016

20 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

TRANSCRIPT

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

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>

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

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>

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.

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

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 Functionname_of _function(parameter_value);

THANKS FOR LISTENING WITHOUT SLEEPING

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

top related