Joomla从组件到模块调用特定功能

时间:2015-03-03 17:08:31

标签: database joomla

我只想调用组件中的特定功能。来自com_rokgallery \ lib \ RokGallery \ Model.file.php中的RokGallery组件是我在模块中需要的& createNew函数。有没有人知道如何从我的模块调用这些并给他们规范变量? 在第31行的components \ com_rokgallery \ lib \ RokGallery \ Job \ Processor \ import.php中,我认为我需要其他的东西......

我希望有人可以帮助我....

问候,马文。

1 个答案:

答案 0 :(得分:0)

理论上,您可以要求文件并使用Class。 要做到这一点,你必须导入rokgallery库。

$include_file = realpath(JPATH_ROOT . DS . 'components'. DS . 'com_rokgallery' . DS . 'include.php');

$included_files = get_included_files();
if (!in_array($include_file, $included_files) && ($libret = require_once($include_file)) !== 'JOOMLA_ROKGALLERY_LIB_INCLUDED') {
    JError::raiseWarning(100, 'RokGallery: ' . implode('<br /> - ', $loaderrors));
    return;
}

一旦你可以使用静态方法createNew

$file = RokGallery_Model_File::createNew($filename, $filepath);