In this tutorial I will explain the steps for Zend Framework 2 Installation via Composer. Steps for install Zend Framework 2 Installation via Composer First set environment variable D:\xampp\php in Advanced system settings. Download and install composer from https://getcomposer.org/Composer-Setup.exe once you installed automatically composer variable will be added into environment variables (C:\ProgramData\ComposerSetup\bin;) Now download and install git from http://msysgit.github.io/ Like below screenshot, select 2nd option when you install. Once you …
Zend Framework Tutorials
Deployment environment in zend application
First development goal for any application is to be able to be deployed in different environments and work with minimal reconfiguration. Zend Framework itself has few specific requirements, so application portability is largely a matter of careful design. Most of the differences between one implementation of an application and another occur during initialization where the configuration settings are read in. In a Zend Framework application, this differentiation most commonly occurs …
Multiple database in zend framework
Zend framework has two levels of abstraction databases and tables. The database abstraction keeps your PHP code independent from database server you use. It means that it is easier for an application to support multiple database servers. To use multiple database in zend framework we need to zend resource plugin ‘multidb’. You can use it in application.ini file as follows: Now in bootstrap file you need to add database adapters …
Useful tricks for zend framework
I am listing some useful tricks for zend framework here that can be used generally. If you want to change the layout for the particular controller views you should use below code of snippet. You can use it in init() function of controller. To check user authentication you should use it in preDispatch() function of controller, if not logged-in then redirect to login page. It will work for all actions …
Custom view Zend Framework
In zend framework MVC architecture it uses views according to the controller action. But I need to use a custom view for the result of the action like want to get cities options on change of country using ajax. Custom view zend framework without layout. So I came to know this can be done by using $this->renderScript(‘ajax/file_path’) in zend framework. Before this we need to disable the layout of the …
Disable view in zend framework
In an application development we need to use ajax several times. So I decided to use a specific controller for all ajax uses. But I found an application error “‘ajax/gedata.phtml’ not found in” on every action of AjaxController. Then I came to know a solution for this problem. Disable view in zend framework. To disable the layout you need to use To set no render you can use these in …
Get Max id from table in Zend Framework
All aggregate function are like an expression for zend framework. So we need to call them by using an instance of Zend_Db_Expr($expr). To get max id from table in zend framework is an simple example for this as explained below. For example If you want to get max id of the table you need to use new Zend_Db_Expr(‘MAX(id) as id’). $this->getMaxId(); will return a max id of the table. Hope …