Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Meta Module to Load Plugins

Meta Module to Load Plugins

Is there anyway that the metamodule can be used so that all the plugins loaded by com_content can be loaded in a custom component eg contentprepare etc?

I have tried this sort of thing

Code:

<?php

$text = JHTML::_('content.prepare', $text); // this is a normal one that works
// JPluginHelper::importPlugin('content', 'extravote');
$product_id = '6';
$product_rating = JHTML::_('content.prepare', '{extravote '.$product_id.'}');
?>
<?php echo JHTML::_('content.prepare', '{extravote '.$product_id.'}'); ?>

Code:

global $mainframe;

include_once('components/com_content/models/article.php');
include_once('components/com_content/helpers/query.php');
$dispatcher =& JDispatcher::getInstance();
$articleObject=new ContentModelArticle();
$id= JRequest::getVar('content_id'); // content_id is the id of the content
$limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // for pagination, required for
$articleObject->setId($id);
$item=new JObject;
$item->text = $articleObject->getArticle();
$item->params = clone($mainframe->getParams('com_content'));
JPluginHelper::importPlugin('content'); // very important
$results=$dispatcher->trigger('onBeforeDisplayContent', array (& $item->text, & $item->params, $limitstart));
echo $results[0];

All directly in my component.

But the extra vote plugin only works in content. If I load my component inside content using another plugin the plugin works.

Thanks Steve

Edited By: uglykidjoe
17-Feb-13 12:01:04

uglykidjoe
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Meta Module to Load Plugins

Hi,

I'm sure that I've managed to load content plugins in custom components before, with not too much trouble. What version of Joomla are you using?

I really don't think you would need to resort to hacks using MetaMod to be able to do this (not that I can think of how you would do that!)

Best regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Dormant:
User Info:
 
Total Users:
5601
Newest User:
deadlin2
Members Online:
0
Guests Online:
136

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked