Search code examples
phpjoomla2.5joomla-extensions

Run content plugin in Category blog layout


I'm running Joomla 2.5 and I need to call a content plugin in a category blog layout. I have tried overriding the default blog layout with the following code so that the plugin would run:

$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content', 'name_of_plugin');
$dispatcher->trigger('onContentPrepare', array (& $item, & $item->params, 0));

However, the plugin is not loading and it gives me the following warning:

 Warning: Parameter 3 to name_of_plugin::onContentPrepare() expected to be a reference, value given in /var/www/libraries/joomla/event/event.php on line 71

Any help as to how I can integrate the plugin into the category blog layout would be very much appreciated.


Solution

  • As it says, array (& $item, & $item->params, 0) is not a reference.

    Solution:

    $dispatcher = JDispatcher::getInstance();
    JPluginHelper::importPlugin('content', 'name_of_plugin');
    $call = array (& $item, & $item->params, 0);
    $dispatcher->trigger('onContentPrepare', $call);