2

I am wanting to do stuff with the Google Data API, the contacts specifically. The easist method i have found so far is using Zend. The problem I am having is adding the Zend framework. Does anyone know how to do this with WordPress?

Thanks

David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132
korki696
  • 103
  • 3
  • 7

4 Answers4

3

you can use "hardcoded" includes if you fail to setup autoloading ->

in /wp-content/themes/levitation/send.php insert to the first line: require_once 'your/path/to/zend/Zend/GData/ClientLogin.php';

Problem is you need to get through all the errors and alwas include the missing class (inside classes are the includes taken care of...

Or in the main file (guess index.php) insert:

set_include_path(get_include_path() . PATH_SEPARATOR . 'your/path/to/zend/');
//for ZF below 1.8 
require_once 'Zend/Loader.php'; 
Zend_Loader::registerAutoload();
 //for ZF > 1.8 
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::setFallbackAutoloader(true);
Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82
  • Hey, That is what I ended up doing. Hardcoding worked, I am not sure why the other moethods didnt work but its working now. – korki696 Oct 07 '09 at 10:27
1

It should be pretty trivial.

Write and test some bootstrap code that sets up ZF's autoloading and make sure it generally works.

Stick that code in a wordpress plugin, and tie things up to the right hooks in wordpress.

timdev
  • 61,857
  • 6
  • 82
  • 92
0

Try this http://blueberryware.net/2008/09/04/wp-library-autoloader-plugin I think all you need is there.

lfx
  • 1,353
  • 13
  • 23
  • I already tried that it wouldnt work. I also tried: http://wordpress.org/extend/plugins/zend-framework/ Whenever it got to a point where i use the framework i get a 500 error. – korki696 Oct 07 '09 at 06:55
  • Find out what is causing the error. Either turn on error_reporting/display_errors(true), or look in the error log. – timdev Oct 07 '09 at 07:18
  • The error I am getting is this: PHP Fatal error: Class 'Zend_Gdata_ClientLogin' not found in /Applications/MAMP/htdocs/wp-content/themes/levitation/send.php on line 82 – korki696 Oct 07 '09 at 07:43
  • Oh and I dont want this as part of a plugin. I need this on one page and thats it. – korki696 Oct 07 '09 at 07:47
  • 1) You're not setting up the autoloader properly. You might be able to get away with just including the right classfiles from Zend, but I have no idea what the dependencies for Gdata_ClientLogin are. 2) Then don't do it as a plugin -- though you should try it sometime, it's not hard to do. – timdev Oct 07 '09 at 08:02
  • I am using the autoloader that came with the plugin so everything is already set up. But no matter what I do it wont work. – korki696 Oct 07 '09 at 08:18
0

Make sure that you are calling:

Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

before you are using that class. And that you have a developer key.

Cosmin
  • 21,216
  • 5
  • 45
  • 60