Zend_Layout & Zend_View Enhancements

Slides:



Advertisements
Similar presentations
Apache Struts Technology
Advertisements

Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
Web Applications Development Using Coldbox Platform Eddie Johnston.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
ITWS-2210 / CSCI Logistics Format – Class w/ mini projects (graded on class participation) – Labs (individual projects, graded on completion in.
Software Architecture Patterns (2). what is architecture? (recap) o an overall blueprint/model describing the structures and properties of a "system"
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Copyright © 2008, Zend Technologies Inc. Zend_Tool: Rapid Application Development In Zend Framework Ralph Schindler Software Engineer, Zend Technologies.
User Group 2015 Version 5 Features & Infrastructure Enhancements.
© 2006 by IBM 1 How to use Eclipse to Build Rich Internet Applications With PHP and AJAX Phil Berkland IBM Software Group Emerging.
Introduction to Struts 2.0 Jenny Ni Joey Feng Winddays Wang Hewmmi Zhu Heather Lv Software School,Fudan University 1.
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
Java Server Pages (JSP) Presented by: Ananth Prasad & Alex Ivanov May 10, 2001.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
ZFApp Preview Walkthrough. What is ZFApp? ZFApp is an application framework built on top of Zend Framework Fully compatible with the latest ZF Versions.
Single Page Applications with AngluarJS Bill Wolff Rob Keiser
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Symfony web development framework is used to develop rapid, complex and large scale web applications faster and in an effective way.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
Fall 2007cs4201 Advanced Java Programming Umar Kalim Dept. of Communication Systems Engineering
Quick overview of ASP.NET Ajax Ajax deep-dive Cover some key real-world problems Discuss solutions, patterns, opportunities Lots of demos And more of.
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
Nested componentization for advanced Web portal solutions Svebor Prstačić, dipl. ing., Dr. sc. Ivan Voras, Dr. sc. Mario Žagar.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
Chapter 3 JSP Overview. The Problem with Servlets processing the request and generating the response are both handled by a single servlet class Java programming.
Adxstudio Portals Training
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Apache Struts Technology A MVC Framework for Java Web Applications.
© Copyright SELA software & Education Labs Ltd Baruch Hirsch St.Bnei Brak Israel
Web Technology Solutions
J2EE Platform Overview (Application Architecture)
DHTML.
Introduction to .NET Florin Olariu
Best Struts 2 Training By TOPS Technologies.
MVC Architecture, Symfony Framework for PHP Web Apps
Web Software Model CS 4640 Programming Languages for Web Applications
Software Design and Architecture
Creating Visual Effects and Animation
AVOIR -African virtual
Processes The most important processes used in Web-based systems and their internal organization.
Unit 6-Chapter 2 Struts.
The Difference Between STATIC & DYNAMIC Websites
Ruby on Rails by Manik Juneja
Introduction to Struts
MSIS 655 Advanced Business Applications Programming
Laying out a website using CSS and HTML
Java Web Application Framework
Chapter 27 WWW and HTTP.
Ruby on Rails by Manik Juneja
What’s a _resource and What Does It Do?
Dealing with images in a resume form.
Java Server Pages (JSP)
JavaServer Faces: The Fundamentals
Introduction to HTML5.
Teaching slides Chapter 6.
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
Struts BY: Tejashri Udavant..
Presentation transcript:

Zend_Layout & Zend_View Enhancements Ralph Schindler Software Engineer, Zend Technologies Zend Framework includes a powerful set of components that facilitate best practices in the area of keeping a consistent look and feel within an application.

Overview The problem Zend_Layout/ZVE solves Simple MVC Usage Benefits of Zend_Layout & ZVE Advanced Usage Case: local layouts within a module Q & A

Exploring the problem area

The Problem What are layouts? Consistent look and feel across application Independent of dispatched application code Common page items such as: Navigation Headers Footers Tag cloud

The Problem Previous attempts (PHP4 till now): Smarty (separation of business & presentation logic) First divergence from Model 1 programming. Common solution (included in every template): Header {include file=‘header.tpl’} Footer files {include file=‘footer.tpl’} Navigation {include file=‘common/nav.tpl’} Ref: http://en.wikipedia.org/wiki/Model_1 In the design of Java Web applications, there are two commonly-used design models, referred to as Model 1 and Model 2. In Model 1, a request is made to a JSP or servlet and then that JSP or servlet handles all responsibilities for the request, including processing the request, validating data, handling the business logic, and generating a response.

The Problem Previous attempts in ZF community: Controller Plugin dispatchLoopStartup() / preDispatch() dispatchLoopShutdown() / postDispatch() ViewRenderer Extension postDispatch() View Extension

The Problem Does a best practices pattern exist? Yes, in PoEAA, M. Fowler describes the Two-Step-View Pattern. “Turns domain data into HTML in two steps: first by forming some kind of logical page, then rendering the logical page into HTML.”

The Problem Can ZF implement a Two-Step-View solution? Yes, if we leverage both the controller and the view layer, a two-step-view is possible. Lets look at the controller dispatch process: (image on next screen)

The Problem

The Problem Zend_Layout is the solution! Zend_Layout by itself is simply a view decorator When used in conjunction with the MVC elements its so much more: A Controller Plugin for detecting when to render a layout An Action Helper to facilitate communication between Action Controllers and Layouts A View Helper to facilitate communication between View Scripts and Layouts

The Problem The Two-Step-View and Zend_Layout introduce new concerns: How can view scripts know the content type of the current layout? View Scripts might use code that implies a requirement at the layout layer: Setting page title Inject JS in the HEAD block Inject Style requirements in the HEAD block Etc.

The Problem With new problems, come new solutions! Zend View Enhancements Doctype helper for setting/getting content type Head Helpers: headScript() headMeta() headStyle() headTitle()

The Problem In addition to solving problems, there are a few other Zend_View Enhancements to simply life: Partial(), PartialLoop(), and Placeholder() exist to aid developers in DRYing up their code Action() View Helper exists to facilitate the dispatching of an Action Controller when a task requires that views attempt to gain new information from the model layer. The Partial view helper is used to render a specified template within its own variable scope. The primary use is for reusable template fragments with which you do not need to worry about variable name clashes. Additionally, they allow you to specify partial view scripts from specific modules.

The Problem Zend_Layout and Zend_View Enhancements are the Solution! DRY up code Best Practices Better code organization both application and display logic Ability to add new features and requirements to a project without having to retrofit.

Using Zend_Layout & Zend_View enhancements within a ZF MVC application BASIC MVC USAGE

Basic MVC Usage File structure

Basic MVC Usage bootstrap.php

Basic MVC Usage Controller Script

Basic MVC Usage View Script

Basic MVC Usage Layout Script

Basic MVC Usage Output HTML & Display

Basic MVC Usage HeadTitle Usage

Basic MVC Usage Output HTML & View

Basic MVC Usage Partial & PartialLoop $this->partial($script, $model) $this->partialLoop($script, $arrayOfModels) Assumes “model” is An array Implements toArray Or is an object that can return properties via object_get_vars By passing a “model” as an object, and providing a key to access the properties

Basic MVC Usage PartialLoop

Just a little review on the benefits

Benefits DRY up code (before and after) Ability to scale and grow code without retrofiting

Benefits Zend_Layout & Zend_View enhancements are a supported best practice. Developers can find the code locations for improvements and fixes faster. Developers can get up to speed quicker with the detailed documentation and best practices these components promote.

Brief discussion of the advanced usage possibilities

Advanced Usage AJAX Support Pulling all the components together to make an Ajaxy Autocompleter headScript headStyle Dojo Toolkit (http://www.dojotoolkit.org/ ) Zend_Layout

Advanced Usage The Model

Advanced Usage Controller

Advanced Usage View

Advanced Usage Layout

Advanced Usage

Advanced Usage JSON Output

Stump the chump!  Q&A TIME

Slides & Sample code will be provided following the confernece CONFERENCE & DEMO

RESOURCES Matthew W. O’Phinney’s Blog: http://weierophinney.net/matthew/archives/163-Using-Zend_View-Placeholders-to-Your-Advantage.html Zend_Layout & Zend_View Manual: http://framework.zend.com/manual/en/zend.layout.html http://framework.zend.com/manual/en/zend.view.html Mailing List & #zftalk RESOURCES

http://framework.zend.com ralph.schindler@zend.com Thank You! http://framework.zend.com ralph.schindler@zend.com