introduction to webapps

Upload: denny-england

Post on 03-Jun-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Introduction to Webapps

    1/60

    Drupal Module

    Development

  • 8/12/2019 Introduction to Webapps

    2/60

    2 PHP Programming with MySQL

    Introduction to Web Development

    In 1990 and 1991,Tim Berners-Lee created theWorld Wide Web at the European Laboratory forParticle Physics (CERN) in Geneva, Switzerland

    The original purpose of the World Wide Web

    (WWW)was to provide easy access to cross-referenced documents that existed on the CERNcomputer network

    Hypertextlinkingallows you to quickly openother Web pages

  • 8/12/2019 Introduction to Webapps

    3/60

    3 PHP Programming with MySQL

    Introduction to Web Development (cont)

    A document on the Web is called a Web page A Web page is identified by a unique address

    called the Uniform Resource Locator (URL)

    A URL is also commonly referred to as a Webaddress

    A URL is a type of Uniform Resource Identifier(URI)

    AWeb siterefers to the location on the Internetof the Web pages and related files

  • 8/12/2019 Introduction to Webapps

    4/60

    4 PHP Programming with MySQL

    Introduction to Web Development (cont)

    Web pages are displayed using a programcalled a Web browser

    A Web serveris a computer that delivers Webpages

    The most popular Web server software isApache HTTP Server (Apache)

    The second most popular Web server is

    Microsoft Internet Information Services (IIS) forWindows

  • 8/12/2019 Introduction to Webapps

    5/60

    5 PHP Programming with MySQL

    HTML Documents

    Web pages are created using Hypertext MarkupLanguage(HTML)

    Web pages are commonly referred to as HTMLpagesor documents

    A markup languageis a set of characters orsymbols that define a documents logicalstructure

    HTML is based on an older language called

    Standard Generalized Markup Language(SGML)

  • 8/12/2019 Introduction to Webapps

    6/60

    6 PHP Programming with MySQL

    HTML Documents (cont..)

    LikeSGML, HTMLwas originally designed as away of defining the elements in a documentindependent of how they would appear

    HTMLhas evolved into a language that defines

    how elements should appear in a Web browser Understanding HTML is critical in learning how

    to write a web application along with the server

    programming

  • 8/12/2019 Introduction to Webapps

    7/607 PHP Programming with MySQL

    Basic HTML Syntax

    HTMLdocumentsare text documents thatcontain formatting instructions called tags

    HTML tags include:

    Formatting commands (boldfaceor italic)

    Controls that allow user input (option buttons or checkboxes)

    Tags are enclosed in brackets (< >)and consistof an opening tag and a closing tag

    Tutorial for learning HTML

    http://www.w3schools.com/html

  • 8/12/2019 Introduction to Webapps

    8/608 PHP Programming with MySQL

    Web Communication Protocols

    A Web page is identified by a unique addresscalled the URL

    Each URL consists of two basic parts:

    A protocol(usually HTTP) and

    Either the domain namefor a Web server or a Webservers Internet Protocol address

    Hypertext Transfer Protocol (HTTP) managesthe hypertext links that are used to navigate theWeb

  • 8/12/2019 Introduction to Webapps

    9/609 PHP Programming with MySQL

    Web Communication Protocols (cont..)

    A hostrefers to a computer system that is beingaccessed by a remote computer

    A domain nameis a unique address used foridentifying a computer such as a Web server on

    the Internet The domain identifieridentifies the type of

    institution or organization (.biz, .com, .edu, .org)

    An Internet Protocol, or IP address, is another

    way to identify computers or devices connectedto the Internet

  • 8/12/2019 Introduction to Webapps

    10/6010 PHP Programming with MySQL

    Web Communication Protocols (cont..)

    An IP address consists of a series of four groupsof numbers separated by periods

    Each Internet domain name is associated with aunique IP address

    HTTP is a component of Transmission ControlProtocol/Internet Protocol (TCP/IP)

    Hypertext Transfer Protocol Secure (HTTPS)

    provides secure Internet connections fortransactions that require security and privacy

  • 8/12/2019 Introduction to Webapps

    11/6011 PHP Programming with MySQL

    Web Communication Protocols (cont..)

    http://www.google.com/help/index.html

    Protocol Domain name Directory Filename

  • 8/12/2019 Introduction to Webapps

    12/6012 PHP Programming with MySQL

    Publishing Your Web Site

    Web Hosting: The publication of a Web site for public access

    Internet access (cable modem, DSL, satellite, dial-upmodem, ISP)

    Internet Service Provider(ISP): Provides access to the Internet along with other types

    of services such as e-mail

  • 8/12/2019 Introduction to Webapps

    13/6013 PHP Programming with MySQL

    Publishing Your Web Site (cont..)

    ISP advantages to hosting a Web site: Extremely fast Internet connections using advanced

    fiber-optic connections

    Large and powerful Web servers and the expertise

    and manpower to maintain and manage them Adomain nameis a unique address used for

    identifying a computer, such as a Web server onthe Internet

  • 8/12/2019 Introduction to Webapps

    14/6014 PHP Programming with MySQL

    Publishing Your Web Site (cont..)

    Domain name registration Pick a domain name that is similar to your business

    name or that describes your Web site

    You cannot use a domain name that is already in use

    or a trademarked name Contact a domain name registrar tofind out the

    availability of a domain name and register it

    Domain names are stored in a master database that

    is maintained by the InterNIC

  • 8/12/2019 Introduction to Webapps

    15/6015 PHP Programming with MySQL

    Publishing Your Web Site (cont..)

    Domain name registration (continued) For a fee, domain names can be registered for a

    specified period of time

    Most hosting sites provide registration service for you

    After you register your domain name, notify your ISPof your domain information

  • 8/12/2019 Introduction to Webapps

    16/6016 PHP Programming with MySQL

    Publishing Your Web Site (cont..)

    File Transfer Protocol(FTP) Is a TCP/IP protocolused for transferring files across

    the Internet

    Transfers files between an FTPclient(your

    computer) and an FTP server(a server capable ofrunning FTP)

    The vehicle that allows you to get your Web page filesto the Web server

  • 8/12/2019 Introduction to Webapps

    17/6017 PHP Programming with MySQL

    Publishing Your Web Site (cont..)

    File Transfer Protocol (continued) Your ISP provides a username and password to log

    on to the FTP site and upload files to the FTP server

    Examples of FTP clients include Firefox and Internet

    Explorer and WinScp Use your browser to log on to an FTP server and upload your

    files

  • 8/12/2019 Introduction to Webapps

    18/6018 PHP Programming with MySQL

    Cascading Style Sheets

    A single piece of CSS formatting information,such as text alignment, is referred to as a style

    The term cascadingrefers to the ability for Webpages to use CSS information from more than

    one source

  • 8/12/2019 Introduction to Webapps

    19/60

    19 PHP Programming with MySQL

    Cascading Style Sheets (continued)

    CSS properties: CSS styles are created with two parts separated by a

    colon

    The propertyrefers to a specific CSS style

    The valueassigned to it determines the styles visualcharacteristics

    Together, a CSS property and the value assigned to itare referred to as a declarationor style declaration

  • 8/12/2019 Introduction to Webapps

    20/60

    20 PHP Programming with MySQL

    Cascading Style Sheets (continued)

    Inline Styles Allow you to add style information to a single element

    in a document

    Internal Style Sheets

    Create styles that apply to the entire documentP { color : blue }selector property value

    External Style Sheets A separate text document containing style

    declarations that are used by multiple documents ona Web site

  • 8/12/2019 Introduction to Webapps

    21/60

    21 PHP Programming with MySQL

    Understanding Web Development

    Web development, or Web programming, refersto the design of software applications for a Website

    The Webmasteris responsible for:

    The day-to-day maintenance of a Web site

    Monitoring Web site traffic and ensuring that the Websites hardware and software are running properly

    Knowledge of Web page design, authoring, and

    development

  • 8/12/2019 Introduction to Webapps

    22/60

    22 PHP Programming with MySQL

    Client/Server Architecture

    Server (back end): A database from which a client requests information

    Fulfills a request for information by managing therequest or serving the requested information to the

    client Responsible for data storage and management

    A system consisting of a client and a server isknown as a two-tier system

  • 8/12/2019 Introduction to Webapps

    23/60

    23 PHP Programming with MySQL

    Client/Server Architecture (cont..)

    Client (front end): Presents an interface to the user

    Gathers information from the user, submits it to aserver, then receives, formats, and presents the

    results returned from the server

    Client/Server Architecture

  • 8/12/2019 Introduction to Webapps

    24/60

    24 PHP Programming with MySQL

    Client/Server Architecture

    (continued)

    A three-tier, or multi-tier, client/server systemconsists of three distinct pieces: Client tier, or user interface tier, is the Web browser

    Processing tier, or middle tier, handles theinteraction between the Web browser client and the

    data storage tier Performs necessary processing or calculations based on the

    request from the client tier

    Handles the return of any information to the client tier

  • 8/12/2019 Introduction to Webapps

    25/60

    25 PHP Programming with MySQL

    Client/Server Architecture (cont..)

    Figure 1-16 The design of a three-tier client/server system

  • 8/12/2019 Introduction to Webapps

    26/60

    26 PHP Programming with MySQL

    JavaScript and Client-Side Scripting

    JavaScriptis: A client-side scripting language that allows Web page

    authors to develop interactive Web pages and sites

    Used in most Web browsers including Firefox and

    Internet Explorer Client-side scriptingis a language that runs on

    a local browser (on the client tier) instead of on aWeb server (on the processing tier)

    JavaScript and Client Side Scripting

  • 8/12/2019 Introduction to Webapps

    27/60

    27 PHP Programming with MySQL

    JavaScript and Client-Side Scripting

    (continued)

    JavaScript allows you to: Turn static Web pages into applications such as

    games or calculators

    Change the contents of a Web page after a browser

    has rendered it Create visual effects such as animation

    Control the Web browser window itself

  • 8/12/2019 Introduction to Webapps

    28/60

    28 PHP Programming with MySQL

    Server-Side Scripting and PHP

    Server-side scriptingrefers to a scripting language thatis executed from a Web server

    Hypertext Preprocessor (PHP)is a server-sidescripting language that is used to develop interactiveWeb sites

    Is easy to learn

    Includes object-oriented programming capabilities

    Supports many types of databases (MySQL, Oracle,Sybase, ODBC-compliant)

  • 8/12/2019 Introduction to Webapps

    29/60

    29 PHP Programming with MySQL

    Server-Side Scripting and PHP (cont..)

    PHP (continued): PHP is an open sourceprogramming language

    Open source refers to software where sourcecode can be freely used and modified

    Cant access or manipulate a Web browser likeJavaScript

    Exists and executes solely on a Web server, where itperforms various types of processing or accessesdatabases

  • 8/12/2019 Introduction to Webapps

    30/60

    30 PHP Programming with MySQL

    Server-Side Scripting and PHP (cont..)

    General rule: Use client-side scripting to handleuser interface processing and light processing,

    such as validation; use server-side scripting forintensive calculations and data storage

    Figure 1-17 How a Web server processes a PHP script

  • 8/12/2019 Introduction to Webapps

    31/60

    Introduction to PHP

    What is PHP? PHP stands for "PHP Hypertext Preprocessor

    An embedded scripting language for HTML like ASPor JSP

    A language that combines elements of Perl, C, andJava

  • 8/12/2019 Introduction to Webapps

    32/60

    Introduction to PHP

    History of PHP Created by Rasmus Lerdorf in 1995 for tracking

    access to his resume

    Originally a set of Perl scripts known as the Personal

    Home Page tools Rewritten in C with database functionality

    Added a forms interpreter and released as PHP/FI:includes Perl-like variables, and HTML embedded

    syntax

  • 8/12/2019 Introduction to Webapps

    33/60

    Introduction to PHP

    History of PHP (cont.) Rewritten again in and released as version 2.0 in

    November of 1997

    Estimated user base in 1997 is several thousand

    users and 50,000 web sites served Rewritten again in late 1997 by Andi Gutmans and

    Zeev Suraski

    More functionality added, database support, protocols

    and APIs

  • 8/12/2019 Introduction to Webapps

    34/60

    Introduction to PHP

    History of PHP (cont.) User base in 1998 estimated 10,000 users and

    100,000 web sites installed

    Version 3.0 was released in June 1998 as PHP

    Estimated user base in tens of thousands andhundreds of thousands of web sites served

  • 8/12/2019 Introduction to Webapps

    35/60

    Introduction to PHP

    History of PHP (cont.) Rewritten again in 1997 by Andi Gutmans and Zeev

    Suraski

    More functionality added (OOP features), database

    support, protocols and APIs PHP 3.0 is released in June 1998 with some OO

    capability

    The core is rewritten in 1998 for improved

    performance of complex applications

  • 8/12/2019 Introduction to Webapps

    36/60

    Introduction

    History of PHP (cont.) The core is rewritten in 1998 by Zeev and Andi and

    dubbed the Zend Engine

    The engine is introduced in mid 1999 and is released

    with version 4.0 in May of 2000 The estimated user base is hundreds of thousands of

    developers and several million of web sites served

  • 8/12/2019 Introduction to Webapps

    37/60

    Introduction

    History of PHP (cont.)

    Version 5.0 will include version 2.0 of the ZendEngine

    New object model is more powerful and intuitive

    Objects will no longer be passed by value; they now will bepassed by reference

    Increases performance and makes OOP more attractive

  • 8/12/2019 Introduction to Webapps

    38/60

    PHP Language Basics

    The Script Tags

    All PHP code is contained in one of several scripttags:

  • 8/12/2019 Introduction to Webapps

    39/60

    PHP Language Basics

    The Script Tags (cont.)

    ASP-style tags Introduced in 3.0; may be removed in the future

  • 8/12/2019 Introduction to Webapps

    40/60

    PHP Language Basics

    The Script Tags (cont.)

    Echo Tags

    Name:

    Address:

  • 8/12/2019 Introduction to Webapps

    41/60

    PHP Language Basics

    Hello World!: An Example

    Like Perl, there is more than one way to do it

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    42/60

    PHP Language Basics

    Hello World!: An Example (cont.)

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    43/60

    PHP Language Basics

    Constants, Data Types and Variables

    Constants define a string or numeric value

    Constants do not begin with a dollar sign

    Examples:

    define(COMPANY, Acme Enterprises); define(YELLOW, #FFFF00);

    define(PI, 3.14);

    define(NL,
    \n);

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    44/60

    PHP Language Basics

    Constants, Data Types and Variables

    Using a constant print(Company name: . COMPANY . NL);

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    45/60

    PHP Language Basics

    Constants, Data Types and Variables

    Data types Integers, doubles and strings

    isValid = true; // Boolean

    25 // Integer

    3.14 // Double

    Four // String

    Total value // Another string

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    46/60

    PHP Language Basics

    Constants, Data Types and Variables

    Data types Strings and type conversion

    $street = 123;

    $street = $street . Main Street;

    $city = Naperville;$state = IL;

    $address = $street;

    $address = $address . NL . $city, $state;

    $number = $address + 1; // $number equals 124

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    47/60

    PHP Language Basics

    Constants, Data Types and Variables

    Data types Arrays

    Perl-like syntax

    $arr = array("foo" => "bar", 12 => true);

    same as

    $arr[foo] = bar;

    $arr[12] = true;

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    48/60

    PHP Language Basics

    Constants, Data Types and Variables Arrays (cont.)

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    49/60

    PHP Language Basics

    Constants, Data Types and Variables

    Objects Currently not much more advanced than than associative

    arrays Using constants

    Before version 5.0, objects are passed by value

    Slow Functions can not easily change object variables

    PHP L B i

  • 8/12/2019 Introduction to Webapps

    50/60

    PHP Language Basics

    Constants, Data Types and Variables

    Operators Contains all of the operators like in C and Perl (even the

    ternary)

    Statements

    if, if/elseif

    Switch/case

    for, while, and do/while loops

    Include and require statements for code reuse

  • 8/12/2019 Introduction to Webapps

    51/60

    B ilt i F ti

  • 8/12/2019 Introduction to Webapps

    52/60

    Built-in Functions

    What comes In the box?

    Directory Functions Platform independent

    Error Handling Functions Recover from warnings and errors

    Filesystem Functions Access flat files

    Check directory, link, and file status information

    Copy, delete, and rename files

    B ilt in F nctions

  • 8/12/2019 Introduction to Webapps

    53/60

    Built-in Functions

    What comes In the box?

    IMAP Functions Manipulate mail boxes via the IMAP protocol

    LDAP Functions Works with most LDAP servers

    Mail Functions mail($recipient, $subject, $message)

    Built in Functions

  • 8/12/2019 Introduction to Webapps

    54/60

    Built-in Functions

    What comes In the box?

    Database Functions dba: dbm-style abstraction layer

    dBase

    Frontbase

    Informix

    Ingres II

    Interbase

    mSQL

    Built in Functions

  • 8/12/2019 Introduction to Webapps

    55/60

    Built-in Functions

    What comes In the box?

    Database Functions (cont.) MySQL

    Oracle

    PostgreSQL

    SQL Server

    MING Macromedia Flash

    PDF Create/manipulate PDF files dynamically

    Built in Functions

  • 8/12/2019 Introduction to Webapps

    56/60

    Built-in Functions

    What comes In the box?

    POSIX Functions Manipulate process information

    Regular Expression Functions Uses POSIX regex

    Semaphore and Socket Functions Available only on Unix

    Session Management Functions

    Summary

  • 8/12/2019 Introduction to Webapps

    57/60

    57 PHP Programming with MySQL

    Summary

    In 1990 and 1991,Tim Berners-Lee created theWorld Wide Web at the European Laboratory forParticle Physics (CERN)

    Transmission Control Protocol/Internet Protocol

    (TCP/IP) is a large collection of communicationprotocols used on the Internet

    A Document Type Definition (DTD) defines theelements and attributes that can be used in adocument

    Summary (cont )

  • 8/12/2019 Introduction to Webapps

    58/60

    58 PHP Programming with MySQL

    Summary (cont..)

    Cascading Style Sheets (CSS) are a standardset by the W3C for managing the design andformatting of Web pages in a Web browser

    A system that consists of a client and a server is

    known as a two-tier system A three-tier client/server system consists of the

    client tier, the processing tier, and the datastorage tier

    Summary (cont )

  • 8/12/2019 Introduction to Webapps

    59/60

    59 PHP Programming with MySQL

    Summary (cont..)

    JavaScript is a client-side scripting language thatallows Web page authors to develop interactiveWeb pages and sites

    Hypertext Preprocessor (PHP) is a server-side

    scripting language that is used for developinginteractive Web sites

    Open source refers to software for which thesource code can be freely used and modified

  • 8/12/2019 Introduction to Webapps

    60/60

    Drupal Module

    Development

    ICT CenterWe are making IT happen

    IC

    T

    Integrity

    Commitment

    Teamwork