您好我正在尝试在外部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');
希望有人可以帮助我。 提前谢谢。