Category Archives: PHP Tutorial

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 🙂

The Basics of PHP

PHP IS THE MOST POPULAR WEB-DEVELOPMENT language in the world. The term “PHP” is actually a “recursive acronym” that stands for PHP: Hypertext Preprocessor. It might look a bit odd, but it is quite clever, if you think of it. PHP is a “scripting language”—a language intended for interpretation and execution rather than  compilation such as, for example, C.

The fact that PHP is interpreted and not compiled, however, does not mean that it is incapable of meeting the demands of today’s highly intensive web environments—in fact,
a properly written PHP script can deliver incredibly high performance and power.

Terms You’ll Need to Understand

  •  Language and Platform
  • Language construct
  •  Data type
  • Opening and closing tags
  • Expression
  •  Variable
  •  Operation and operator precedence
  • Conditional structures
  • Iteration and Loops
  • Functions
  •  Variable variables and variable functions

The two biggest strengths of PHP are its simplicity and the incredible set of functionality
that it provides. As a language, it incorporates C’s elegant syntax without the hassle of
memory and pointer management, as well as Perl’s powerful constructs—without the
complexity often associated with Perl scripts.

As a platform, PHP provides a powerful set of functions that cover a multitude of different
needs and capabilities. Programmers who work on commercial platforms such as
Microsoft ASP often marvel at the arsenal of functionality that a PHP developer has at
his fingertips without the need to purchase or install anything other than the basic interpreter package.What’s more, PHP is also extensible through a set of well-defined C APIs that make it easy for anyone to add more functionality to it as needed.

The basic element of a PHP application is the script. A PHP script contains a number of
commands that the PHP interpreter reads, parses, and executes.