Hi,
In Chapter 9 there is a HelloWorld Plugin that does not appear to work. I already found one problem in plgHelloWorld.php line 25 JEventDispatcher has been renamed JDispatcher. I get no errors with my typed in code or the code provided by the book. I also checked the the show intro text and it is on both globally and in each article. When I run Firebug in firefox I get no errors but I also see no sign that the code is running. This makes me suspect that there is something wrong with how the event is triggered but I can't figure out what. Here is the code:
PHP Code:
<?php
/**
* @version
* @package plgHelloWorld
*/
// No Direct Access
defined('_JEXEC') or die('Restricted Access');
class plgContentHelloWorld extends JPlugin {
// PHP4 compatible constructor
function plgContentHelloWorld( &$subject ) {
parent::__construct( $subject );
}
// Name function same as event so it will be called.
function onAfterDisplayTitle(& $article, & $params, $limitstart=0) {
$myOutput = "<h3>Hello World!</h3>";
return $myOutput;
}
}
// Instantiate the plug-in with an instance of the event dispatcher
$myPlugin =& new plgContentHelloWorld( JDispatcher::getInstance());
?>