Joomla 为什么我的插件没有被触发?
我正在开发一个插件,它应该为插件提供支持。但是我没有让它调用(并执行)自己的插件——我已经前后阅读了文档,我一辈子都没有看到这个问题 所以我建立了一个简单的例子来理解这个机制——幸运的是,这个例子也失败了,所以至少我的(错误)理解是一致的 主要插件是this(mainplugin.php)Joomla 为什么我的插件没有被触发?,joomla,joomla2.5,Joomla,Joomla2.5,我正在开发一个插件,它应该为插件提供支持。但是我没有让它调用(并执行)自己的插件——我已经前后阅读了文档,我一辈子都没有看到这个问题 所以我建立了一个简单的例子来理解这个机制——幸运的是,这个例子也失败了,所以至少我的(错误)理解是一致的 主要插件是this(mainplugin.php) 它与mainplugin.xml一起安装: <?xml version="1.0" encoding="utf-8"?> <extension type="plugin" version
它与mainplugin.xml一起安装:
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="1.6" method="upgrade" group="content">
<name>Content - mainplugin</name>
<creationDate>2013-08-07</creationDate>
<version>1</version>
<releaseDate>2013-08-07 22:00:21</releaseDate>
<releaseType>First public release!</releaseType>
<author>Michael Baas</author>
<authorEmail>mb@mbaas.de</authorEmail>
<authorUrl>mbaas.de</authorUrl>
<copyright>(c) 2005-2013 Michael Baas</copyright>
<description>Testing the plugins-for-plugins-concept</description>
<license>free free free</license>
<files>
<filename plugin="mainplugin">mainplugin.php</filename>
</files>
<config />
</extension>
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="1.6" method="upgrade" group="mainplugin_plugin">
<name>Content - mainplugin_plugin</name>
<creationDate>2013-08-07</creationDate>
<version>1</version>
<releaseDate>2013-08-07 22:00:21</releaseDate>
<releaseType>First public release!</releaseType>
<author>Michael Baas</author>
<authorEmail>mb@mbaas.de</authorEmail>
<authorUrl>mbaas.de</authorUrl>
<copyright>(c) 2005-2013 Michael Baas</copyright>
<description>Testing the plugins-for-plugins-concept</description>
<license>free free free</license>
<files>
<filename plugin="mainplugin_plugin">mainplugin_plugin.php</filename>
</files>
<config />
</extension>
内容-主插件
2013-08-07
1.
2013-08-07 22:00:21
第一次公开发布!
迈克尔·巴斯
mb@mbaas.de
mbaas.de
(c) 2005-2013迈克尔·巴斯
测试插件的插件概念
免费的
mainplugin.php
以下是mainplugin类型mainplugin\u plugin的mainplugin插件,名为mainplugin\u plugin.php:
<?php
class plgContentMainplugin_plugin extends plgContentMainplugin // or should it be JPlugin? Tried both, nothing worked.
{
function onmainiscalling($data) {
$r="Mainplugin_plugin->onmainiscalling was called";
return $r;
}
}
?>
及其安装程序(mainplugin_plugin.xml):
内容-mainplugin\u插件
2013-08-07
1.
2013-08-07 22:00:21
第一次公开发布!
迈克尔·巴斯
mb@mbaas.de
mbaas.de
(c) 2005-2013迈克尔·巴斯
测试插件的插件概念
免费的
mainplugin_plugin.php
在您的xml中,您说该组是
group="mainplugin_plugin"
JPluginHelper::importPlugin('mainplugin_plugin');
但之后你会把它当作内容组的一部分
class plgContentMainplugin_plugin extends plgContentMainplugin
你需要在这个问题上下定决心,并确保插件位于正确的文件夹中,并且使用正确的groupt名称进行调用
请注意,importPlugin将组名作为第一个参数,将特定插件名作为第二个可选参数
我也不知道为什么你会正常地扩展插件类。我是说你可以。。。但我不认为如果你这样做了,你应该在另一组中扩展它。谢谢-你发现了它!:-)最后一句话——你是说我应该扩展JPlugin,而不是我的插件类?我最初是这样做的(并将恢复),但作为修复的绝望搜索的一部分,我还尝试将其重命名为我的基本插件类…最后是一个巨大的“谢谢”-我的插件现在将上线,我正在等待JED团队处理我的提交:)
class plgContentMainplugin_plugin extends plgContentMainplugin