w eb a pplications & w eb s ervices development using z end f ramework sayed ahmed b. sc....

18
WEB APPLICATIONS & WEB SERVICES DEVELOPMENT USING ZEND FRAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer Science [email protected] 1 647–624–8509 http://sayed.justetc.net http ://www.justetc.com http://www.justetc.org

Upload: ambrose-long

Post on 28-Dec-2015

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

WEB APPLICATIONS & WEB SERVICES DEVELOPMENT USING ZEND FRAMEWORK

Sayed Ahmed

B. Sc. Engineering in Computer Science and Engineering

M. Sc. in Computer Science

[email protected]

1 647–624–8509

http://sayed.justetc.net

http://www.justetc.com

http://www.justetc.org

Page 2: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

2

sayed@

juste

tc.net

OVERVIEW Purpose

Web Application Development Web Services Development

Overview on Zend Framework Based on Object Oriented PHP (100% OOP) Supports PHP 5.1.4 and later Based on MVC architecture Component based

Components can be used almost independently Uses loosely coupled architecture for the component

architecture Components when used together create a very

powerful and extensible framework

11

/10

/20

11

Page 3: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

3

sayed@

juste

tc.net

OVERVIEW Some Features

Simple to use database abstraction layer (Zend_db)

Forms component that implements HTML form rendering Form validation Form filtering

Zend_Auth and Zend_Acl provide user authentication and authorization

11

/10

/20

11

Page 4: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

4

sayed@

juste

tc.net

ZEND FRAMEWORK QUICK START Steps

Zend Framework & MVC Introduction Create Your Project Create A Layout Create a Model and Database Table Create A Form

11

/10

/20

11

Page 5: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

5

sayed@

juste

tc.net

ZEND FRAMEWORK AND MVC Zend has many components that can be

used independently However, to establish a basic structure for

your Zend Framework applications Zend provides an advanced MVC implementation Zend MVC includes components such as

Zend_Controller Zend_Layout Zend_Config Zend_Db Zend_Db_Table Zend_Registry

11

/10

/20

11

Page 6: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

6

sayed@

juste

tc.net

MVC ARCHITECTURE1

1/1

0/2

01

1

Page 7: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

7

sayed@

juste

tc.net

CREATE YOUR PROJECT

Install Zend Server http://www.zend.com/en/products/server-ce/down

loads

Or Download the Zend Framework and extract it http://framework.zend.com/download/latest

Create the project structure Run the command

% zf create project quickstart

11

/10

/20

11

Page 8: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

8

sayed@

juste

tc.net

BASIC PROJECT STRUCTURE1

1/1

0/2

01

1

Page 9: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

9

sayed@

juste

tc.net

LOADING INITIAL COMPONENTS AND RESOURCES The Bootstrap class loads the initial

resources and components application/controllers/ as the default

directory in which to look for action controllers

11

/10

/20

11

Page 10: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

10

sayed@

juste

tc.net

INITIAL CONFIGURATION OF YOUR APPLICATION File used

application/configs/application.ini 11

/10

/20

11

Page 11: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

11

sayed@

juste

tc.net

ACTION CONTROLLERS [INDEXCONTROLLER] Associated Directory

/controller/action

11

/10

/20

11

Page 12: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

12

sayed@

juste

tc.net

ERROR CONTROLLER1

1/1

0/2

01

1

Page 13: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

13

sayed@

juste

tc.net

VIEWS Views are written in plain old PHP View scripts are placed in

application/views/scripts/ And further categorized

using the controller names Hence, we can create

Sub-directories index/ error/

Within these subdirectories you will find and create view scripts

that correspond to each controller action exposed Our default case

index/index.phtml error/error.phtml.

11

/10

/20

11

Page 14: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

14

sayed@

juste

tc.net

CREATE VIRTUAL HOST1

1/1

0/2

01

1

Page 15: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

15

sayed@

juste

tc.net

UPDATE HOSTS FILE C:\WINDOWS\system32\drivers\etc

127.0.0.1 quickstart.local

11

/10

/20

11

Page 16: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

16

sayed@

juste

tc.net

FIRE YOUR APPLICATION

Point your browser to the server name As you configured in the previous section

You will see a welcome page

11

/10

/20

11

Page 17: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

17

sayed@

juste

tc.net

REFERENCES

http://framework.zend.com/manual/en/

11

/10

/20

11

Page 18: W EB A PPLICATIONS & W EB S ERVICES DEVELOPMENT USING Z END F RAMEWORK Sayed Ahmed B. Sc. Engineering in Computer Science and Engineering M. Sc. in Computer

18

sayed@

juste

tc.net

http://www.developly.com/creating-3-step-layouts-with-zendlayout

11

/10

/20

11