2

我将组件写入 joomla cms,我需要使用 zend 代码来谷歌日历。我写了新的类来组织操作,但是我对 zend 有问题。

我的代码类是:

<?php
// Protect from unauthorized access
defined('_JEXEC') or die('Restricted Access');


// Load framework base classes

$zend_library_path = 'helpers/library/Zend';
set_include_path ( JPATH_ROOT . PATH_SEPARATOR . $zend_library_path);
//include ('Json.php');

//echo JPATH_ROOT . PATH_SEPARATOR . $zend_library_path;
 include_once('Loader.php');
jimport('joomla.application.component.controller');
JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');



class GoogleCalendar
{

我有变暖:

Warning: include_once(Loader.php): failed to open stream: No such file or directory in /home/samba

我必须改变它才能工作?

4

2 回答 2

2

您应该将该zend目录存储在 Joomla! 的libraries目录中。这就是它的用途。然后,您导入 Zend 自动加载器。

<?php
// Protect from unauthorized access
defined('_JEXEC') or die('Restricted Access');

// Init the Joomla! framework here!

// Load autoloader for Zend
jimport('zend.loader');
Zend_Loader::registerAutoload();

// Load framework base classes
jimport('joomla.application.component.controller');
JTable::addIncludePath(JPATH_COMPONENT . '/tables');

class GoogleCalendar
{

其他一切都应该神奇地工作。

于 2013-06-14T15:33:32.393 回答
0

尝试更具体地使用您的包含功能:

set_include_path ( JPATH_ROOT . PATH_SEPARATOR . $zend_library_path);

或许:

set_include_path ( JPATH_ROOT . PATH_SEPARATOR . JPATH_COMPONENT .'/'. $zend_library_path .'/');
于 2013-06-14T07:27:27.477 回答