Page 1 of 1

Other content plug-ins

Posted: 29 Nov 2012, 23:57
by pastvne
Hi:
I've just installed and tested PhocaPDF into my Jooml 2.5 site. After futzing some with my template that overrode the standard joomla article default.php template, I got it to work.

However, I have one more thing to accomplish before I call Phoca my new best friend.

I also use a content plug in that I use to inject values into my template. The call to the plug in uses the curly brace {} markers to denote the plug-in name (i.e., {my_content_plugin}) In the normal HTML view of the article, {my_content_plugin} works but when I PDF the article, {my_content_plugin} does not.

I have the same issue with the standard joomla PRINT and I'm about to embark on an effort to modify that script to include {my_content_plugin} helper. My hope is that by fixing PRINT, that PDF will function. In either event, I'll report back here my experimentation and results. With the number of {plugin} content extentions available for Joomla, I'm thinking this will be a topic of general interest.

Any advice, please reply.

Re: Other content plug-ins

Posted: 30 Nov 2012, 07:39
by pastvne
I now have the joomla print button working with {my_content_plug-in} but the Phoca PDF'd document does not seem to allow {my_content_plug-in} to be called and therefore the values injected by {my_content_plug-in} are not present in the PDF document.

I believe that somewhere in PhocaPDF I need to register the helper for {my_content_plug-in} so that the content is injected into the document before it is passed to PhocaPDF. I'll look in the Phoca scripts to see if I can see where ContentOnPrepare content events are being registered (or not).

I wondered if perhaps the issue was that the PhocaPDF plug-in was being called prior to {my_content_plug-in}. I went to Joomla's plug-in manager to look for other content plug ins but I don't see Phoca's plug-in listed under the content plug in type.

But, if anyone has some advice or a pointer to save me a bit of detective work, I'd sure appreciate it.

Thanks,

Bruce Decker

Re: Other content plug-ins

Posted: 04 Dec 2012, 18:14
by pastvne
Looks like I'm on my own on this one. I'm re-writing the stock view.pdf.php script to properly render content plug-ins for Phoca. Hope to have this working and will post results. Hope I'm heading in the right direction.

Re: Other content plug-ins

Posted: 04 Dec 2012, 19:08
by pastvne
Okay:
Here is a hack that I used to get this working for me. This is on Joomla 2.5 and I'm using Ja-Purity-ii template.

The scripts that Phoca sources to render the document to be passed to the pdf function. The script is /components/com_content/views/article/view.pdf.php

It appears that this script has not received much attention for the new release of Joomla. But it still works and this is the script that Phoca references to gather it's article image before pdf'ing it. The problem is that this script references the form of the article without any of the content plug-ins applied. So, you basically get the raw article with the plug-in tags instead of the fully-dressed article with content from the plug-ins added.

A one-line mod of the script above will cause the image of the document that includes the version of the article with content plug-ins rendered to be returned to Phoca:

On about line 128 of the script you will find:

Code: Select all

		$document = &JFactory::getDocument();
		$document->setHeader($this->getHeaderText($item, $params));

		echo $item->text;		
		$document->setArticleText($item->article_text);
		$document->setArticleTitle($item->title);

		//parent::display($tpl);
See the following modification

Code: Select all

	
                $document = &JFactory::getDocument();
		$document->setHeader($this->getHeaderText($item, $params));

		echo $item->text;
			
                //bpibd|no-op|need to pass content-plug-in form of document back to phoca|$document->setArticleText($item->article_text);
                $document->setArticleText($item->text); //bpibd|added|this passing the article with content-plugin injected back to Phoca
		$document->setArticleTitle($item->title);

		//parent::display($tpl);
The line beginning with //bpibd|no-op... is the original instruction preprended with a comment tag and note indicating that it has been no-opped.
The line below it is the new line that I inserted which is a copy of the original line with my connect appended to the end

I hope that someone else finds this helpful. If anyone has a way to do this without a hack, I'd sure appreciate knowing about it.

Re: Other content plug-ins

Posted: 02 Mar 2015, 13:50
by seppo
I have similar problem. I am using plugin to make dynamic content with some php code (plugin sourcerer from nonumber), but the output of PDF stops where that code starts.

Than you pastvne for your research on this, but this solution did not work for me. Anyone from Phoca or someone else knows solution?

Re: Other content plug-ins

Posted: 03 Mar 2015, 13:17
by Jan
Hi, unfortunately, this needs to be tested directly for the specific plugin.

As written here:
https://www.phoca.cz/phocapdf

PDF is not like HTML. PDF is a static document and HTML is dynamic document - there is large amount of code which tries to convert dynamic document to static but of course not everything can be transformed.

So if the plugin renders some simple html code, there is no problem to somehow transfrom it to PDF but if the plugin renders difficult code including e.g. javascript parts, etc. etc., such then cannot be transformed to static document.

So the extension - the plugin needs to be checked - which code (html) it exactly produces (if it includes javascript or external css, etc.) and it needs to be tested if such content can be translated into PDF instructions.

I have tested some of the plugins (e.g. Phoca Gallery plugins) and they are rendered in PDF (e.g. because they use simple HTML including images, etc.)

But really cannot say what is the situation for external plugins :-(

Jan