0% found this document useful (0 votes)
115 views19 pages

Online Zend Training For Beginners

Zend Framework 2 (ZF2) is the leading open-source framework for developing web applications and services with PHP. ZF2 incorporates advanced design patterns and is implemented using object-oriented code, with a component structure that incorporates a "use-at-will" highly modular design.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views19 pages

Online Zend Training For Beginners

Zend Framework 2 (ZF2) is the leading open-source framework for developing web applications and services with PHP. ZF2 incorporates advanced design patterns and is implemented using object-oriented code, with a component structure that incorporates a "use-at-will" highly modular design.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

WELCOME TO VIBRANT

TECHNOLOGIES & COMPUTERS


--------------------------------------------------Online Zend Training For Beginners

What is ZFApp?

ZFApp is an application framework built on top of Zend Framework

Fully compatible with the latest ZF Versions

Designed to bridge the gap between the framework and using the
framework as an application platform for a new application

Motivations

The current Zend Framework doesn't lend itself very well as an


Application platform at present
Relatively high barrier to entry
It's free-form structure which makes it useful for integration with
current applications makes it less apt at ground-up development
Created to serve the needs of the Professional Services
department at Zend

Issues ZFApp is designed to address

One-step download to deployment

ZFApp in its final form will provide a helper application to create


a new application:

$ ./createapp ZFBlog

Increased ease of use of Zend Framework's MVC model

Auto Templating

Clear controller / view flow

Improved Controller abilities

Issues ZFApp is designed to address

Consistency and Best Practice

Automatic usage of Zend_Filter_Input when possible

Consistent Error handling

Can be plugged directly into Zend Platform for application


monitoring

Recommended Architecture

ZFApp gives you enough to reproduce the pattern, using a


solid architecture, without writing so much of the
application for you that it becomes bloated.

Getting Started

Getting Started with Framework is fairly easy, even without an


automated installer

1) Copy entire ZFApp/ directory to application location

2) Execute appgen.php

3) Provide write-access to the web server to the webtmp/


directory of your app

4) Set up Apache's DocumentRoot to the www/ dir of the app


and turn on AllowOverride = All

Getting Started

Once the 5 steps


are completed
your're all set,
just point your
browser to the
local server!

ZFApp Layout

ZFApps have a consistent structure

include/ application-specific includes

include/views/ Application views

webtmp/ application temp storage

ZFApp/ ZFApp framework

lib/ ZFApp supporting libraries (Zframework, Smarty)

www/ application document root

Provided Templates

ZFApp provides the View component of MVC and


as such a number of templates
views/_main/index.tpl

Global shell template, contains basic HTML for a wellformed page

views/_main/error.tpl

Basic Render Flow

View Binding

Sometimes it makes sense to have two actions use the same view
Within a Controller
i.e. BlogController::postAction() and BlogController::editAction()
use the same form
Handled by adding an entry to

$this->_viewMap

$this->_viewMap('editAction' => 'postAction');

Final Render Notes

Each Controller has it's own view scope

$this->assign() will set variables in it's own scope only

$this->assignGlobal() will set globally available variables


(username, etc)

You can also pass parameters into a sub-template

{render module=Blog action=view entry=$entry} will set


blog/view.tpl {$entry}

Final Render Notes

Each Controller has it's own view scope

$this->assign() will set variables in it's own scope only

$this->assignGlobal() will set globally available variables


(username, etc)

You can also pass parameters into a sub-template

{render module=Blog action=view entry=$entry} will set


blog/view.tpl {$entry}

Error Handling

ZFApp uses a completely exception-based error model

Smarty and PHP internal errors are converted into a child of


ZFApp_Exception

Exceptions are caught by ZFApp if uncaught elsewhere, and a


useful error page is displayed which can be customized

Error Handling

_main/error.tpl

Future Plans

Auto Installation support

Automatic filtering of URL parameters

Internal (trusted) and External (untrusted) Controller parameters

Implementation of neat view data modifiers

{$string|textify}

AJAX-focused Controller subclasses abstracting away JSON


interaction

Application Controller

All ZFApp Controllers extend from ZFApp_Controller_Action_Base,


and most should extend from ApplicationController

ApplicationController provides a global controller where


actions available to all controllers can be placed

Base Controller provides all of the aforementioned nice


functionality

Thank you

You might also like