This is my plugin:
// 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
According to their documenation
Return Value
String. Returned value from this event will be displayed in a placeholder. Most templates display this placeholder after the article separator.
The plugin gets displayed and doesnt throw an error when I install it.. But the event never gets triggered. I dont see it in the document
<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>anattaligg@graeit.com</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>
Based on the
version="2.5"in your XML, your plugin is not being called because you have the wrong event name.The event names have changed since the Plugin/Events/Content for Joomla! 1.5 document was written. I’ve marked it as a 1.5 document to make that clear.
Events were renamed to be more consistent (domain/period/event e.g. Content/After/Display), so, the event you want is now called
onContentAfterSaveand you can find more information about renamed events in the article “Adapting a Joomla 1.5 extension to Joomla 1.6“If you want to support Joomla! 1.5 in your plug-in as well you will also have to add a compatibility layer to catch the 2.5 call and redirect it to your method. e.g.
N.B. Not tested code just typed in…