最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

include - including Zend Gdata library path error

programmeradmin0浏览0评论

I'm trying to include the Zend Gdata module into a plugin, but this error appears on plugin activation:

include_once(Zend\Gdata\YouTube.php) [function.include-once]: failed to open stream: No such file or directory in \Zend\Loader.php on line 146

any help appreciated, thanks

I have the main plugin file in the root and then a Zend subfolder which contains the module. This was just copied from the demo app which works fine on the same XAMPP installation, so it's something to do with how WordPress includes files?

/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';

/**
* @see Zend_Gdata_YouTube
*/
Zend_Loader::loadClass('Zend_Gdata_YouTube');

I'm trying to include the Zend Gdata module into a plugin, but this error appears on plugin activation:

include_once(Zend\Gdata\YouTube.php) [function.include-once]: failed to open stream: No such file or directory in \Zend\Loader.php on line 146

any help appreciated, thanks

I have the main plugin file in the root and then a Zend subfolder which contains the module. This was just copied from the demo app which works fine on the same XAMPP installation, so it's something to do with how WordPress includes files?

/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';

/**
* @see Zend_Gdata_YouTube
*/
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Share Improve this question edited Jan 8, 2012 at 19:16 paul asked Jan 8, 2012 at 16:45 paulpaul 3281 silver badge10 bronze badges 1
  • 1 Needs more info. So far it simply looks like you used the wrong path. – kaiser Commented Jan 8, 2012 at 16:52
Add a comment  | 

1 Answer 1

Reset to default 1

* UPDATE * Please see at the bottom for right solution!!!

One way to solve this problem is that you use ini_set to set the path to your Zend folder.

I have the Zend folder in my current theme folder so i only need to tell path var what the path to my theme folder is. This code goes to functions.php if its in the theme you want to use it of course :)

ini_set ( 'include_path', ini_get ( 'include_path' ) . ':../:' . dirname ( __FILE__ ) . ':' );

require_once 'Zend/Loader.php';

Zend_Loader::loadClass ( 'Zend_Gdata_YouTube' );
Zend_Loader::loadClass ( 'Zend_Gdata_AuthSub' );
Zend_Loader::loadClass ( 'Zend_Gdata_ClientLogin' );

I will also share a screenshot just in case the structure is confusing anyone: As you see i have lifted Zend folder out from the ZendGdata-1.11.11 folder

Hope this helps :)

Edit:

Apparently i messed up a bit, the Zend folder im my case is actually in the ROOT. That mean if i enter www.mysite/Zend i should be able to access php files there. So, simplifying that all, Zend/ folder should not be in:

www.mysite/wp-content/themes/theme-name/Zend

But it should be in

www.mysite/Zend
发布评论

评论列表(0)

  1. 暂无评论