Joomla 从组件到模块调用特定函数
Joomla call specific function from component to module
我只想调用组件中的特定功能。来自 com_rokgallery\lib\RokGallery\Model.file.php 中的 RokGallery 组件是我在模块中需要的 &createNew 函数。有谁知道我如何从我的模块中调用它们并给它们指定变量?
在第 31 行的 components\com_rokgallery\lib\RokGallery\Job\Processor\import.php 中,我认为我需要这些...
希望有人能帮帮我....
此致,马文。
理论上您可以要求文件并使用 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);
我只想调用组件中的特定功能。来自 com_rokgallery\lib\RokGallery\Model.file.php 中的 RokGallery 组件是我在模块中需要的 &createNew 函数。有谁知道我如何从我的模块中调用它们并给它们指定变量? 在第 31 行的 components\com_rokgallery\lib\RokGallery\Job\Processor\import.php 中,我认为我需要这些...
希望有人能帮帮我....
此致,马文。
理论上您可以要求文件并使用 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);