Return to Snippet

Revision: 34008
at October 15, 2010 21:22 by harikaram


Initial Code
$document =& JFactory::getDocument();
$oldDoc = clone( $document );
$document = JDocument::getInstance('html');
				
JPluginHelper::importPlugin('content');
$article = new JObject();
$article->text = $lesson->rendered;
$dum = array();
$dispatcher->trigger( 'onPrepareContent', array( &$article, &$dum, 0 ) );
$lesson->rendered = $article->text;

$document = $oldDoc;

Initial URL


Initial Description
Say you want to run content plugins on JDocumentRAW content (like in a component that returns JSON data).  Some methods in JDocumentHTML like "addCustomTag" will cause the app to fail on JDocumentRAW doc types which don't have this method.  Thus you need to temporarily replace it to trick the content plugins...

Initial Title
Run content plugins on JDocument type RAW (ie temp. replace JDocument with a different type)

Initial Tags
json, joomla

Initial Language
PHP