Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在外部php中加载Joomla K2模块_Php_Joomla_Joomla3.0 - Fatal编程技术网

在外部php中加载Joomla K2模块

在外部php中加载Joomla K2模块,php,joomla,joomla3.0,Php,Joomla,Joomla3.0,嗨,我正在尝试在外部php文件中加载K2内容模块。我找到了一些关于这个的信息和例子,但问题是它只适用于一些Joomla模块(自定义html和其他),而不适用于k2模块。这是mi代码: define( '_JEXEC', 1 ); define( 'JPATH_BASE', realpath(dirname(__FILE__) .'' ) ); define( 'DS', DIRECTORY_SEPARATOR ); require_once ( JPATH_BASE .DS. 'includ

嗨,我正在尝试在外部php文件中加载K2内容模块。我找到了一些关于这个的信息和例子,但问题是它只适用于一些Joomla模块(自定义html和其他),而不适用于k2模块。这是mi代码:

define( '_JEXEC', 1 );

define( 'JPATH_BASE', realpath(dirname(__FILE__) .'' ) );
define( 'DS', DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS. 'includes' .DS. 'defines.php' );
require_once ( JPATH_BASE .DS. 'includes' .DS. 'framework.php' );

$app = JFactory::getApplication('site');
$app->initialise();

$modules  = JModuleHelper::getModules("contenedor-eventos");
$document = JFactory::getDocument();     
$attribs  = array();
$attribs['style'] = 'xhtml';

foreach ($modules as $mod)
{
    echo JModuleHelper::renderModule($mod, $attribs);
}
我有以下错误消息:致命错误:在第289行的/home/my_user/my_domain/modules/mod_k2_content/helper.php中找不到类“K2Model”

helper.php第289行中的代码是:

$model = K2Model::getInstance('Item', 'K2Model');
希望有人能帮助我。 提前谢谢