Wrox Programmer Forums
|
BOOK: Professional Joomla! ISBN: 978-0-470-13394-1
This is the forum to discuss the Wrox book Professional Joomla! by Dan Rahmel; ISBN: 9780470133941
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Joomla! ISBN: 978-0-470-13394-1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2009, 03:16 PM
Registered User
 
Join Date: Apr 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap 9 HelloWorld Plug problems.

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 plgContentHelloWorldJDispatcher::getInstance());

?>
 
Old June 2nd, 2009, 02:37 PM
Registered User
 
Join Date: May 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy I am having the same problem

I put some echos in the constuctor, onAfterDisplayTitle and at the bottom of the module, the module is loading but neither the constructor or the onAfterDisplayTitle is being called.
 
Old June 26th, 2009, 07:33 PM
Registered User
 
Join Date: May 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Smile I think I found it

The onAfterDisplayTitle trigger output is only displayed when the summary text is configured to be hidden.I changed the trigger to onBeforeDisplayContent and it is working.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Plug-in for Outlook using C# [email protected] C# 2005 1 October 29th, 2008 04:27 PM
problem in helloworld progarmme in chapt 18 clnbabu BOOK Beginning Linux Programming, 3rd Edition 0 August 25th, 2007 03:54 AM
Problems with Chap. 17 pg.557 & 558 alk BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 2 August 19th, 2007 09:58 AM
Chap 10 FileSystemObject Problems orbbital BOOK: Beginning ASP 3.0 2 April 20th, 2005 10:19 AM
How to use the bootstrapper plug-in ? Help please! irnbru VS.NET 2002/2003 1 April 10th, 2005 03:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.