What is the Zend Framework ?

Zend Framework (ZF) is an open source, object-oriented web application framework implemented in PHP 5 and licensed under the New BSD License.

The Zend Framework is a simple, straightforward, open-source software framework for PHP 5 designed to eliminate the tedious details of coding and let you focus on the big picture. Its strength is in its highly-modular MVC design, making your code more reusable and easier to maintain.

Requirements for Zend framework

Zend Framework requires PHP 5.2.4 or later since version 1.7.0. Previous versions required PHP 5.1.4 or later, although the ZF Programmer's Reference Guide strongly recommended PHP 5.2.3 or later for security and performance improvements included in these versions of PHP. Zend Framework 2.0 will require PHP 5.3.3 or later. PHPUnit 3.0 or later is required to run the unit tests shipped with Zend Framework. Many components also require PHP extensions.

Building and running Zend Framework applications

Zend Framework applications can run on any PHP stack that fulfills the technical requirements.
Zend Technologies provides a PHP stack, Zend Server (or Zend Server Community Edition), which is advertised to be optimized for running Zend Framework applications. Zend Server includes Zend Framework in its installers, along with PHP and all required extensions. According to Zend Technologies, Zend Server provides improved performance for PHP and especially Zend Framework applications through opcode acceleration and several caching capabilities, and includes application monitoring and diagnostics facilities.
Zend Studio is an IDE that includes features specifically to integrate with Zend Framework. It provides an MVC view, MVC code generation based on Zend_Tool (a component of the Zend Framework), a code formatter, code completion, parameter assist, and more.[13]
Zend Studio is not free software, whereas the Zend Framework and Zend Server Community Edition are free.
Zend Server is compatible with common debugging tools such as Xdebug.
Other developers may want to use a different PHP stack and another IDE such as Eclipse PDT which works well together with Zend Server. A preconfigured, free version of Eclipse PDT with Zend Debug is available on the Zend web site.

What is the Zend Framework ?

Zend_Json_Server and JSON-RPC 2.0

Zend_Json_Server and JSON-RPC 2.0
The 4 available parameters are:
+ jsonrpc – the version you are using; I’m using 2.0.

word-wrap, word-break URLs and Text Content with CSS

word-wrap, word-break URLs and Text Content with CSS
To wrap long URLs, strings of text, and other content, just apply this carefully crafted chunk of CSS code to any block-level element (e.g., perfect for <pre> tags):

Rotate with CANVAS JavaScript in HTML5

Step 1: Put the JavaScript code below in your HEAD.

Step 2: Put the HTML code below into the BODY


1.getInstance() is used to retrieve a front controller instance

2.setControllerDirectory() is used to tell the dispatcher where to look for action controller class files

3.addControllerDirectory() is used to add a module name, it will set the directory for the default module -            overwriting it if it already exists.

4.getControllerDirectory() is used to get the current settings for the controller directory.

5.addModuleDirectory() allows you to pass the name of a directory containing one or more module directories.

6.getModuleDirectory() is used to determine the path to a particular module or the current module.

7.dispatch(Zend_Controller_Request_Abstract $request = null, Zend_Controller_Response_Abstract $response = null) does the heavy work of the front controller.
It may optionally take a request object and/or a response object.

8.Zend_Controller_Front::run($path) is a static method taking simply a path to a directory containing controllers.

9.resetInstance() can be used to clear all current settings.

10.setDefaultControllerName() and getDefaultControllerName() let you specify a different name to use for the default controller  and retrieve the current value.

11.setDefaultAction() and getDefaultAction() let you specify a different name to use for the default action  and retrieve the current value.

12.setRequest() and getRequest() let you specify the request class or object to use during the dispatch process and to retrieve the current object.

13.setRouter() getRouter() let you specify the router class or object to use during the dispatch process and to retrieve the current object.

14.setBaseUrl() and getBaseUrl() let you specify the base URL to strip when routing requests and to retrieve the current value.

15.setDispatcher() and getDispatcher() let you specify the dispatcher class or object to use during the dispatch process and retrieve the current object.

16.setResponse() and getResponse() let you specify the response class or object to use during the dispatch process and to retrieve the current object.

17.registerPlugin(Zend_Controller_Plugin_Abstract $plugin, $stackIndex = null) allows you to register plugin objects.

18.unregisterPlugin($plugin) let you unregister plugin objects. $plugin may be either a plugin object or a string denoting the class of plugin to unregister.

19.returnResponse($flag) is used to tell the front controller whether to return the response (TRUE) from dispatch(), or if the response should be automatically emitted (FALSE).

20.setParam($name, $value) allows you to set a single parameter of $name with value $value.

21.setParams(array $params) allows you to set multiple parameters at once using an associative array.

22.getParam($name) allows you to retrieve a single parameter at a time, using $name as the identifier.

23.getParams() allows you to retrieve the entire list of parameters at once.

24.clearParams() allows you to clear a single parameter , multiple named parameters, or the entire parameter stack.

Using Zend_Layout with the Zend Framework MVC

simple example of zend_layout.
First we define some defined default.

The next, we create LayoutController.

File layout in application\layouts\scripts\index.phtml

Read and write configuration files the format xml with Zend_Config

1. Read ini file.

 I have a configuration file /application/configs/db.ini as follows:

We use the class to read file Zend_Config_Xml db.xml


2.Write xml file

My01.xml output file: