2

So I'm attempting to install some Zend Framework components mainly so I can use the google API picasa library.

I tried adding the Zend library to my

codeigniter-> application-> libraries

and then running $this->load->library('Zend'); but I receive

Unable to load the requested class: zend

Then I tried doing it

$clientLibraryPath = '/usr/local/lib/php/Zend/Gdata';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);

Error

> Exception thrown trying to access Zend/Loader.php  using
> 'use_include_path' = true. Make sure you  include Zend Framework in
> your include_path  which currently  contains:
> .:/usr/share/php:/usr/share/pear:/usr/local/lib/php/Zend/Gdata

I'm not sure on what the actual path should be I also uploaded the Zend libary into users/local/lib/php as well. What am I doing wrong?

Undermine2k
  • 1,481
  • 4
  • 28
  • 52

1 Answers1

6

See this: you need to create file Zend.php in libraries as image below: enter image description here

and past this code into it:

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 in Controller. Here I show one example to load Picasa Web Albums.

    $this->load->library('zend');
    $this->zend->load('Zend/Loader');
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Gdata_Photos');
    Zend_Loader::loadClass('Zend_Http_Client');

With another example to load Google Spreedsheet.

$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 );

for more information see this

mujaffars
  • 1,395
  • 2
  • 15
  • 35
  • 1
    I actually had to set EXT to ".php" to get mine to load not sure if this is a CI version 3 issue. – Someone Jul 16 '15 at 11:11