/ Published in: PHP
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...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$document =& JFactory::getDocument(); $oldDoc = clone( $document ); $document = JDocument::getInstance('html'); JPluginHelper::importPlugin('content'); $article = new JObject(); $article->text = $lesson->rendered; $lesson->rendered = $article->text; $document = $oldDoc;