Joomla CMS和ZEND代码

时间:2013-06-14 07:22:39

标签: php zend-framework joomla

我将组件写入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

我需要改变它的工作吗?

2 个答案:

答案 0 :(得分: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
{

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

答案 1 :(得分:0)

尝试使用include函数更具体:

set_include_path ( JPATH_ROOT . PATH_SEPARATOR . $zend_library_path);

parhaps:

set_include_path ( JPATH_ROOT . PATH_SEPARATOR . JPATH_COMPONENT .'/'. $zend_library_path .'/');