Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
|
How to have the plugins processed when genrating PDF documents of content items (for Joomla 1.5.x)? |
| Written by kksou | ||
| Sunday, 15 June 2008 | ||
|
In a standard Joomla 1.5 installation, you can generate a PDF version of a content item by clicking on the pdf icon appearing in the top right corner of the content item page. However, if you have installed some plugins such as the Include Content Item or the googleAds plugins, you will find that the plugin do not get processed during the generation of the PDF documents. As as result, you will see the plugin tags such as {googleAds} or {include_content_item}, appearing in the PDF documents! This is, of course, undesirable. This article shows you how to have the plugins processed during the generation of the PDF documents for content items. Note: the steps below are for Joomla 1.5.x. If you're using Joomla 1.0.x, please refer to How to have DirectPHP plugin process RSS feed (for Joomla 1.0.x)?. ExplanationIn the original Joomla installation, there is no trigger during the generation of PDF documents. When there is no trigger, none of the plugin gets called. In order for the plugins to be processed, we need to add a trigger. SolutionsAll you need is to add 2 lines to have plugins processed during the generation of PDF documents!
// Initialize some variables
$article = & $this->get( 'Article' );
$params = & $article->parameters;
// 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);
That's it! Now try generating the PDF documents. You should find all the plugin tags disappear in the PDF documents as they get processed by the respective plugins. User reviews Average user ratings: 5.0 (from 1 user)Note: You have to be a registered member to leave a comment. Free registration here. |
||
| < Prev | Next > |
|---|




July 28, 2008 4:13am
Thanks, this works just perfect.
But could you please make an example how to mod the Joomla 1.5 search so it does parse any "content plugin" too?
I have made a little plugin which displays user specific content. Its more a "hack" than good code but it works. The only problem is that the search removes the "{plugin arg}{/plugin}" and just dispalys ALL content. It works with you mod for the pdf view. But i have no idea how to deal with the search.
Thanks!!