這是我的插件:的Joomla事件犯規被觸發
// no direct access
defined('_JEXEC') or die('Restricted access');
// Import library dependencies
jimport('joomla.plugin.plugin');
class plgContentEya extends JPlugin
{
function plgContentEya(&$subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Plugin method with the same name as the event will be called automatically.
*/
function onAfterDisplayContent(&$article, &$params, $limitstart)
{//Echo script there
echo "script works";
// Plugin code goes here.
// You can access parameters via $this->params.
return "<script src='http://widget.eya.com/sprk.1.0.2.js' type='text/javascript'></script>";
}
}
http://docs.joomla.org/Plugin/Events/Content
根據他們documenation
Return Value
String. Returned value from this event will be displayed in a placeholder. Most templates display this placeholder after the article separator.
插件獲取顯示,當我安裝它不拋出一個錯誤。但該事件從未被觸發。我沒有看到它根據您在XML中的version="2.5"
的
<install version="2.5" type="plugin" group="content">
<name>plg_content_eya</name>
<author>eya</author>
<creationDate>February 2013</creationDate>
<copyright>(C) 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.eya.com</authorUrl>
<version>2.5.0</version>
<description>Adds eya plugin ot your site</description>
<files>
<filename plugin="eya">eya.php</filename>
</files>
</install>
你的構造應該命名爲plgContentEya,一樣的類名。這可能會導致父構造函數不被調用。雖然不完全確定,但值得一試。 – 2013-02-10 13:27:16
沒有,對不起,這是我的筆誤..我不知道它是什麼..可它是XML? – BlackFire27 2013-02-10 14:26:45