Plugin development 2

Locked
User avatar
uweD
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 112
Joined: Mon May 14, 2007 9:38 pm
Location: Auckland -- New Zealand
Contact:

Plugin development 2

Post by uweD » Tue Aug 28, 2007 3:13 am

Hi,
Well, that was an interesting day... A couple of grey hairs more I have to say. I am still struggling a lot to actually write a plugin in the object orientated fashion which is described here. http://dev.joomla.org/component/option, ... te_plugin/

Triggering the event works fine (or this is what I believe):

Code: Select all


JPluginHelper::importPlugin('search');
$result = $mainframe->triggerEvent('onSearchSuccesFull',array(&$sResult));





Listening for the event is the core issue for me:

The 'legacy' way works fine:

Code: Select all

<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$mainframe->registerEvent( 'onSearchSuccesFull', 'plgPopulateModule' );
function plgPopulateModule ($param) {
return $param;

}
The object orientated way fails and I simply don't know way at all:

Code: Select all

<?php

defined('_JEXEC') or die();
jimport('joomla.event.plugin');

class plgSearchBar extends JPlugin{ 

	var $param		= 	null;


    function plgSearchBar(& $subject) {
        parent::__construct($subject);
	    
        $this->_plugin = JPluginHelper::getPlugin( 'search', 'plgEHiveSearchBar' );
        $this->_params = new JParameter( $this->_plugin->params );
	
    }

    function onSearchSuccesFull ($param) {
      $param = "testPluginEhive";
      
      return $param;
    }
}


It seems to me that Joomla! actually access the file itself but doesn't execute the member function 'onSearchSuccesFull ' which reflects the events name.... What am I missing?

Thanks for your help and sorry for starting a new post but the other one became a bit messy.

Thanks,
Uwe
Last edited by uweD on Wed Aug 29, 2007 5:05 am, edited 1 time in total.
***** Manual signatures are NOT allowed ********** Manual signatures are NOT allowed *****
Uwe Duesing
http://www.uweduesing.com
Skype:uweOnehunga

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: Plugin development 2

Post by AmyStephen » Tue Aug 28, 2007 3:28 am

Uwe -

Is it possible onSearchSuccesFull spelled incorrectly (should be onSearchSuccessful) is a problem?

Just a guess?
Amy :)

User avatar
uweD
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 112
Joined: Mon May 14, 2007 9:38 pm
Location: Auckland -- New Zealand
Contact:

Re: Plugin development 2

Post by uweD » Tue Aug 28, 2007 3:30 am

Hi Amy,

Thanks for pointing that out but I misspelled that event consistently  :)

Thanks,
Uwe
***** Manual signatures are NOT allowed ********** Manual signatures are NOT allowed *****
Uwe Duesing
http://www.uweduesing.com
Skype:uweOnehunga


Locked

Return to “Joombie Coding Q/A”