I am developing a content-based plugin fro Joomla 2.5.17 . I don't know why, but it seems to me that the events like onContentBeforeSave or even onContentBeforeDisplay are not called properly at my website.
Here is the code of my plugin. No errors, but nothing really happens:
Code: Select all
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.plugin.plugin');
class plgContentImage extends JPlugin
{
/**
* Constructor - note in Joomla 2.5 PHP4.x is no longer supported so we can use this.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
*/
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Plugin method with the same name as the event will be called automatically.
*/
public function onContentBeforeDisplay($context, &$row, &$params, $limitstart)
{
return "<div>OnContentBeforeDisplay</div>";
}
function onContentBeforeSave($context, &$article, $isNew)
{
$app = JFactory::getApplication();
global $mainframe;
if ( $context == "com_content.article" ) {
$article->fulltext = "AAA";
echo "test";
}
return true;
}
}
?>
Thanks in advance for any help.