Recently, I’ve been working on Joomla CMS based project, where I’ve added some additional features to the content (AJAX added content from database) using Jumi plugin.
In standard Joomla installation, by clicking PDF icon in top right corner of the article, you can generate a PDF version of your content. However, plugins are not processed: instead you will see plugin tags, ie. {jumi [test.php}. How to get it processed?
Solution (for Joomla 1.5)
I have found the solution on phpGTK2 CookBook. Quickly summarizing:
- Edit view.pdf.php localized in <joomla root>/components/com_content/views/articles.
- Around line 72 (just before $document = &JFactory::getDocument();), add two lines that triger plugin processing:
JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0));
So the whole code in the neighbourhood of line 72 should look like this:
// process the new plugins JPluginHelper::importPlugin('content', 'image'); $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0)); JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0)); $document = &JFactory::getDocument(); // set document information $document->setTitle($article->title); $document->setName($article->alias); $document->setDescription($article->metadesc); $document->setMetaData('keywords', $article->metakey);
This is it! Now after clicking PDF icon, all your plugins should be processed in the output document. However, not all CSS is processed… but this is another story 😉
marzec 17th, 2010