Tag Archives: Zend

Integrate Zend framework library in codeigniter

Today I will show you how to Integrate Zend framework library in codeigniter.

First you need to download zend libraries from their official site.

Then copy the library folder to “Application/Libraries/” folder

Now you need to create a loader for codeigniter to use those libraries. Save this code to Application/Libraries/Zend.php file

if (!defined('BASEPATH')) { exit('No direct script access allowed'); }

class Zend {

public function __construct($class = NULL) {

ini_set('include_path',ini_get('include_path') . PATH_SEPARATOR . APPPATH . 'libraries');

if ($class) {

require_once (string) $class . EXT;
log_message('debug', "Zend Class $class Loaded");

}else {

log_message('debug', "Zend Class Initialized");

}
}

public function load($sClassName) {

require_once (string) $sClassName . EXT;

log_message('debug', "-> Zend Class $sClassName Loaded from the library");

}

}

That’s it. Now call library what you need from your method.

Here I show one example to load Google Spreedsheet.

public function index(){

    $this->load->library('zend');
    $this->zend->load('Zend/Gdata/Spreadsheets');

    $oSpreadSheet = new Zend_Gdata_Spreadsheets();

    $entry = $oSpreadSheet->newCellEntry();
    $cell = $oSpreadSheet->newCell();
    $cell->setText('My cell value');
    $cell->setRow('1');
    $cell->setColumn('3');
    $entry->cell = $cell;
    var_dump(  $entry );
}

Now enjoy the power of zend in your codeigniter web application.

Happy Coding 🙂

Creating custom routes in your zend framework application

One of my zend framework project need to define custom routs . I have google a lot then found a solution.

Here I share my solution.

You can define custom routes in zend framework in many ways. I create a ini file to do this.

First add those line to your Bootstrap file.

protected function _initRoutes() {
$this->bootstrap('frontcontroller');
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$myRoutes = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
$router->addConfig($myRoutes, 'routes');
}

This will tell the system routing information from “routes.ini” file from application/configs.

Then you need a routes.ini file in application/configs. Now create a new file named routes.ini there.

Now say for example your domain is http://yourdomain.com and you want the http://yourdomain.com/index to be http://yourdomain.com/live Continue reading Creating custom routes in your zend framework application

Install Zend framework on WAMP server

Few day’s ago we deployed one of our web application to windows machine. Then I have learn how to set up zend framework on windows machine.

Zend install on wamp is very easy.

FIrst download the latest zend framework from the official site of zend . Here is the link . http://framework.zend.com/download/latest

Upload the folder to your local server.

1. Edit php.ini

php,ini file is located under
c:wampbinapacheapache2.2.11bin

folder..

if you want to find where php.ini file

go to following link and

http://localhost/?phpinfo=1

 ;;;;;;;;;;;;;;;;;;;;;;;;;

; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"

; Windows: "path1;path2"
include_path = ".;c:phpincludes;c:wamplibraryzendframeworklibrary"

after changing php.ini you need to restart wamp server.

Now create virtual host. Here is step by step instruction for configure virtual host on WAMP for local development.

Firstly you will need to download and install WAMP. Continue reading Install Zend framework on WAMP server