Page 1 of 1

Getting plugin parameters

Posted: Sat Sep 15, 2007 1:25 pm
by mtlnews
Hey,

Im trying to get the plugin parameters for a plugin like this:

$this->_params->get( 'THE_PARAMETER_I_WANT' )

but it obviously doesn't work. Can anyone help me out with this?

Thanks, Francis

Re: Getting plugin parameters

Posted: Sat Sep 15, 2007 2:02 pm
by mtlnews
Actually,

I tryed using this insted:

$this->params->get( 'THE_PARAMETER_I_WANT' )

and in the construct function, instead of writing:

function plg( &$subject )
{
parent::__construct( $subject );

// load plugin parameters
$this->_plugin = JPluginHelper::getPlugin( 'PLUGIN_GROUP', 'PLUGIN_NAME' );
$this->_params = new JParameter( $this->_plugin->params );
}

like the tutorial suggests, I wrote:

function plg( &$subject, $params ) {
parent::__construct( $subject, $params );
}

and now it works wonderfully

Re: Getting plugin parameters

Posted: Sat Sep 15, 2007 2:52 pm
by pe7er
Great! Thanks for sharing!

PS: Could you please mark your first message in this thread as "solved" ? (Modify the first message and choose the Message Icon [solved] Image).
This way the list of messages shows that the question has been solved, and other users can benefit from it.
Thanks!

Re: Getting plugin parameters

Posted: Sat Jan 12, 2008 2:07 am
by slongcgs
Thanks, great tip!!!