Zend Framework for IBM i

Similar documents
RPG & PHP REST SERVICES WITH APIGILITY. Chuk Shirley Sabel Steel Service Club Seiden

Installing Shibbolized Tiqr

Zend Framework. Jerome Hughes Consultant

A Tcl Web Framework (Arnulf's Tcl Web Framework)

Zend Framwork 2.0 Cookbook

Introduction to Zend Framework 2 on the IBM i

Zend Framework Overview

Zend Framework 1.8 Web Application Development

Melis Platform V2. Front-Office. Create a website. Content: Date Version 2.0

Web Development with Zend Framework 2

Zend Framework's MVC Components

ZEND_TOOL IN ZF 1.8. By Ralph Schindler. Copyright 2007, Zend Technologies Inc.

Get in Touch Module 1 - Core PHP XHTML

Building a Zend Framework application. Rob Allen

DE-2310 Developing Web Applications Using Microsoft Visual Studio 2008 SP1

Reminders. Full Django products are due next Thursday! CS370, Günay (Emory) Spring / 6

Improving Application Performance by Submitting Scripts to Batch using Zend Server for IBM i

Symfony is based on the classic web design pattern called the MVC pattern

SYMFONY2 WEB FRAMEWORK

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

Introduction to PHP. Handling Html Form With Php. Decisions and loop. Function. String. Array

The Magento Certified Developer Exam (Beta) Self-Assessment Checklist

Developing Web Applications Using Microsoft Visual Studio 2008 SP1

PHP 101. Function Junction. Mike Pavlak Solutions Consultant (815) All rights reserved. Zend Technologies, Inc.

SharePoint 2013 Power User

Helpline No WhatsApp No.:

DOWNLOAD OR READ : ZEND FRAMEWORK TUTORIAL FOR BEGINNERS STEP BY PDF EBOOK EPUB MOBI

Index. Note: Boldface numbers indicate code and illustrations; an italic t indicates a table.

An Introduction to JavaScript & Bootstrap Basic concept used in responsive website development Form Validation Creating templates

PHP 101 for IBM i. Mike Pavlak, Solution Consultant Zend Technologies, Inc.

HCW Human Centred Web. HuCEL: Keywords Experiment Manual. School of Computer Science. Information Management Group

Course Outline. Developing Web Applications with ASP.Net MVC 5. Course Description: Pre-requisites: Course Content:

DevShala Technologies A-51, Sector 64 Noida, Uttar Pradesh PIN Contact us

Contents in Detail. Foreword by Xavier Noria

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL.

Cheap, Fast, and Good You can have it all with Ruby on Rails

Hue Application for Big Data Ingestion

Ebook : Overview of application development. All code from the application series books listed at:

Getting Started with Zend Framework

# Fix the issue:.xlsx and.docx are being saved as a zip file in Internet explorer

LEARN TO DEVELOP A LIVE PROJECT AS PER IT STANDARDS. Module 1: What we are going to Learn. Prerequisites

Saurus CMS Installation Guide

OpenEMR ZF2 Module Installer. 1. Authentication to Database and SQL Query Handling. 1.1 Zend\Db\Adapter. Introduction

DE Introduction to Web Development with Microsoft Visual Studio 2010

20486-Developing ASP.NET MVC 4 Web Applications

Strategies for Rapid Web Prototyping. Ruby on Rails. Clemens H. Cap

Full Stack Web Developer

Oracle Transparent Gateways

THE EXPERT S VOICE IN OPEN SOURCE. Zend. Framework. Armando Padilla. Learn to build professional web applications with Zend Framework.

TRANSITIONING TO A WEB- BASED DATA MANAGEMENT AND DATA SHARING MODEL. Chris Bardash, GISP

micro-framework Documentation

10267A CS: Developing Web Applications Using Microsoft Visual Studio 2010

Single Page Applications using AngularJS

IBM i Modernization with PHP

PDF # SECURE LOGINS PHP USER GUIDE

Site Caching Services Installation Guide

Introduction to IBM DB2

BEAWebLogic. Portal. Overview

Improve Web Application Performance with Zend Platform

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2

MCSE Productivity. A Success Guide to Prepare- Core Solutions of Microsoft SharePoint Server edusum.com

Application Design and Development: October 30

PHP 5 e-commerce Development

Splitting and Merging. Down and Dirty Made Easy

How To Redirect A Webpage Cheat Sheet

This tutorial introduces you to FuelPHP framework and makes you comfortable with its various components.

Azure Certification BootCamp for Exam (Developer)

Ibm Db2 9 Fundamental Certification Guide

Azure Development Course

PHP and MySQL Programming

Development of an e-library Web Application

Transaction Cordinator: Design and Planning

Zend Filter: A Secure Man's Best Friend. by Aaron Saray

The connection has timed out

Notes Discussed project needs and possible tool use Everything needs to be documented very well for future use Stretch goal discussed

PORTAL RESOURCES INFORMATION SYSTEM: THE DESIGN AND DEVELOPMENT OF AN ONLINE DATABASE FOR TRACKING WEB RESOURCES.

COURSE OUTLINE: OD10267A Introduction to Web Development with Microsoft Visual Studio 2010

SHAREPOINT 2013 DEVELOPMENT

Advanced Functions with DB2 and PHP for IBM i

Pro ASP.NET MVC 2 Framework

This document contains information on fixed and known limitations for Test Data Management.

Standard Error Processing Rogue Wave Software, Inc. All Rights Reserved. 1

Developing ASP.NET MVC 4 Web Applications

Time to EARN. On Job Training. Time to L-EARN

CSS. HTML5,CSS3,JS & PHP Simplified. Smart Course for Absolute Beginners. REGISTER AT:

Review. Fundamentals of Website Development. Web Extensions Server side & Where is your JOB? The Department of Computer Science 11/30/2015

"Charting the Course... MOC A Introduction to Web Development with Microsoft Visual Studio Course Summary

Full Stack Web Developer

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. TurboGears

Developing ASP.NET MVC 5 Web Applications

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

Bringing Together One ASP.NET

iflame INSTITUTE OF TECHNOLOGY

Course Outline and Objectives: Database Programming with SQL

Web Development: Dynamically Generated Content (SCQF level 8)

Database Test Study Guide Answers

C R E A T I V E A C A D E M Y. Web Development. Photography

EMC Documentum Site Caching Services

CMSilex Documentation

This tutorial is designed for software programmers who would like to learn the basics of ASP.NET Core from scratch.

Transcription:

Zend Framework for IBM i Part II: MVC and ZF Applications

Who is Jeff Olen? Author of bestselling IBM i Programmers Guide to PHP Zend Certified Engineer PHP 5 IBM i developer for 20+ years Co-founder of Olen Business Consulting, Inc. Lead Systems Software Engineer at Vertex Business Services NA

What we will learn What the basic MVC directory structure is The basics of MVC applications How to build ZF applications using DB2 tables How to add bells and whistles to your ZF views.

What you need to know PHP HTML Object Oriented techniques fundamentals Zend Framework Zend Studio - Optional

Review Why use a Framework at all? One entry point for all applications No more maintenance of multiple scripts each with their own relative paths, database connections and authentication, etc Facilitates creating reusable code. What is MVC? MVC is a design pattern. You might think of a design pattern as a skeleton or framework on which your application will be built. The MVC design pattern is based on the idea that there are three components that work together to form a complex application. These components are the Model, the View and the Controller.

The Three Components of MVC: Model, View and Controller What is a Model? Models are the interfaces with the DB. This is where your actual database i/o and validation takes place. There is also where you MAY find some business logic. What is a View? The View contains any code that relates to presentation (i.e. User interface) and presentation logic such as caching or templates.

The Three Components of MVC: Model, View and Controller con t What is a controller? A controller is just that. It controls and launches each of the various activities in an application. For instance in a CRUD application you might have methods in your controller for Add, Update, View and Delete. This is where the business logic resides. Although there may be some business logic in the Model, strictly speaking this is not best practice.

Questions?

ZF Quickstart Application Source available at: http://framework.zend.com We will walk thru the code in the ZF Quickstart application. Go over changes to access DB2 tables. Create our own configuration.ini and access it to determine which database to use. Change the code to be database independent.

MVC directory structure /guestbook /application /configs /controllers /data /forms /layouts /scripts /models /views /scripts /helpers /library /public

.htaccess Apache setup file Location: /guestbook/public/.htaccess SetEnv APPLICATION_ENV development RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]

Application.ini configuration Location: guestbook/application/configs/application.ini [production] phpsettings.display_startup_errors = 0 phpsettings.display_errors = 0 bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = Application" resources.frontcontroller.controllerdirectory = APPLICATION_PATH "/controllers" resources.frontcontroller.params.displayexceptions = 0 resources.layout.layoutpath = APPLICATION_PATH "/layouts/scripts" resources.view[] = resources.db.adapter = "PDO_SQLITE" resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook.db" [staging : production] [testing : production] phpsettings.display_startup_errors = 1 phpsettings.display_errors = 1 resources.db.adapter = "PDO_SQLITE" resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-testing.db" [development : production] phpsettings.display_startup_errors = 1 phpsettings.display_errors = 1 resources.db.adapter = "PDO_SQLITE" resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-dev.db"

Where do we start? Location: /guestbook/public/index.php

Bootstrap Location: /guestbook/application/bootstrap.php

Questions?

ZF Controller workflow

Brief word about routing ZF Applications use the URL to determine which controller to use to handle a specific request. The default router (object type Zend_Controller_Router_Route_Module) expects the URL in one of the following formats. http://subdomain.domain.com/application/controller/action Or http://subdomain.domain.com/controller/action Examples: http://guestbook.dynalias.net/guestbook/sign Routes to the GuestbookController and the Sign action. http://guestbook.dynalias.net/guestbook Routes to the GuestbookController. No action is specified uses default action (usually index.phtml) http://guestbook.dynalias.net No Controller and no action. Uses default controller (indexcontroller) and default action (index.phtml).

Controllers The Quickstart project has three controllers. IndexController ErrorController GuestbookController

IndexController Location: /guestbook/application/controllers/indexcontroller.php

IndexController default action Location: /guestbook/application/views/scripts/index/index.phtml

Guestbook Layout Location: /guestbook/application/layouts/scripts/layout.phtml

IndexController - output

ErrorController Location: /guestbook/application/controllers/errorcontroller.php

ErrorController - output

GuestbookController Location: /guestbook/application/controllers/guestbookcontroller.php

GuestbookController default action Location: /guestbook/application/views/scripts/guestbook/index.phtml

GuestbookController.php cont d

Questions?

Application Model Guestbook The model in this case is divided into three classes. 1. Application_Model_GuestbookMapper class - Defines the actual mapping between the DB table and the Application_Model_Guestbook class properties. 2. Application_Model_Guestbook class - Defines class properties used to store and manipulate the DB column data. - Contains all GET and SET methods. 3. Application_Model_DbTable_Guestbook class - Calls constructor methods that initialize the metadata for the DB table. - Sets the name and schema (library) of the DB table.

Application_Model_DbTable_Guestbook Location: /guestbook/application/models/dbtable/guestbook.php Calls the following constructor methods: 1. _setupdatabaseadapter() Makes sure a DB adapter has been provided; gets the default adapter from the registry if needed. 2. _setupmetadata() calls describetable() method to load the $_cols array with the columns from the DB table. 3. _setupprimarykey() defaults the primary key columns to those reported by describetable().

Application_Model_Guestbook Location: /guestbook/application/models/guestbook.php

Application_Model_Guestbook cont d Location: /guestbook/application/models/guestbook.php

Application_Model_GuestbookMapper Location: /guestbook/application/models/guestbookmapper.php

Application_Model_GuestbookMapper Location: /guestbook/application/models/guestbookmapper.php

GuestbookController.php cont d

Application_Form_Guestbook Location: /guestbook/application/forms/guestbook.php

Application_Form_Guestbook cont d Location: /guestbook/application/forms/guestbook.php

Application_Form_Guestbook cont d

Questions?

DB2 access changes Create a DB2 table using the SQL below: create table Guestbook ( Id for column GUESTBKID integer not null generated by default as identity(no cache) primary key, email varchar( 100) not null, comment varchar( 50) not null, created timestamp not null default current timestamp );

DB2 access changes cont d Modify the Application_Model_DbTable_Guestbook class IBM i uses all uppercase names so protected $_name = guestbook becomes protected $_name = GUESTBOOK

DB2 access changes cont d Modify the Application_Model_GuestbookMapper class - Again IBM i requires all uppercase names so the field names being retrieved or written to the DB need to be all uppercase.

DB2 access changes cont d Modify the Application_Model_GuestbookMapper class - We also need to uppercase the array indexes in the save method and remove the output for created because we are going default it (per the SQL) to the current timestamp.

DB2 access changes cont d Modify the Application.ini

DB2 access changes cont d THAT S IT!

Further Information Many good books available

Training/Certification Zend offers Framework classes and certification. Starting Fall of 2010 System i Network will be offering a 5 week course on Zend Framework taught by Jeff Olen.

Thank you! Questions? Last chance!