Page 1 of 1

php code with sourcerer not evaluated in pdf

Posted: 21 Sep 2016, 15:22
by stephen3179
Hello,

I installed the latest version of joomla 3.6.2 and also the latest version of sourcerer and module anywhere (plugins regular labs) and phoca pdf.
Since that, my code php inside an article is not evaluated in the pdf view (article view is ok).

In the pdf, there is the code below instead ok "bonjour" (same problem with inclusion of module anywhere)

Code: Select all

{source}
<?php
echo "bonjour";
?>
{/source}
In know the order of system plugin is important and it is ok (plugins regular labs = level 0 and phoca pdf system plugin = level 1)

Before these updates, the code in pdf was well evaluated.

I contacted regular labs and answered this : "That's an issue with phoca pdf, which seemingly does not pass the content through the Joomla plugins."

Thanks for your help.

Re: php code with sourcerer not evaluated in pdf

Posted: 22 Sep 2016, 13:12
by Jan
Hi, check the options of Phoca PDF, there is a parameter where you can disable or enable displaying of content plugins inside the PDF. Check if it is enabled.

But, be aware, it must be tested, as written here in red box: https://www.phoca.cz/phocapdf - PDF is not like HTML - PDF is static and HTML is dynamic. So plugin output code can be problematic and there can be problems with displaying it - this is why this must be properly tested.
"That's an issue with phoca pdf, which seemingly does not pass the content through the Joomla plugins."
This is of course completely wrong information based on inorance of the plugin. The plugin accepts content plugins. It gets the article output with plugins rendered and in case there is a problem with displaying plugin, this can be disabled in plugin parameters.

See this article:
https://www.phoca.cz/documents/47-phoca- ... f-document

Jan

Re: php code with sourcerer not evaluated in pdf

Posted: 23 Sep 2016, 10:30
by stephen3179
Thanks for your answer, but the option is well enabled because i updated the module in order to keep my parameters of the pdf,
and the content plugin display only text.

I give you more informations about the problem, i have two environments, one before updates, the other after updates.
The two environments have exactly the same contents, and the urls tested are :

article view : index.php?option=com_content&view=article&id=122
pdf view : index.php?option=com_content&view=article&id=122&format=pdf

Environment 1 before updates :

Phoca pdf : 3.0.0 (com_phocapdf_v3.0.0.zip, plg_phocapdf_content_v3.0.0.zip and plg_system_phocapdf_v3.0.1.zip)
Joomla : 3.3.0
Php : 5.5.11
Regular labs Sourcerer : 4.3.3
Regular labs Modulesanywhere : 3.4.3

=> article view : static text ok and dynamic text ok
=> pdf view : static text ok and dynamic text ok

Environment 2 after updates :

Phoca pdf : 3.0.2
Joomla : 3.6.2
Php : 5.6.245.6.24
Regular labs Sourcerer : 6.2.1
Regular labs Modulesanywhere : 6.0.1

=> article view : static text ok and dynamic text ok
=> pdf view : static text ok and dynamic text KO (php source code displayed and not evaluated)

Seemingly the issue com from the latest version of Phoca pdf ?

Thank you for your help.

Re: php code with sourcerer not evaluated in pdf

Posted: 25 Sep 2016, 15:22
by Jan
Hi,

Code: Select all

Seemingly the issue com from the latest version of Phoca pdf ?
See the date in the documentation
https://www.phoca.cz/documents/47-phoca- ... f-document

I have updated it after your post, using the latest Phoca PDF.

As written, rendering the plugin code inside PDF can be problematic as HTML is not PDF.

Can you paste a screenshot of what is displayed in article and what it PDF?

Jan

Re: php code with sourcerer not evaluated in pdf

Posted: 26 Sep 2016, 10:51
by stephen3179
Hello,

I do a copy paste and there is nothing else in the article (screenshot i can't because "[img] is OFF").
Content is very simple, only text :

article view :

Today :
26/09/2016



pdf view :

Today :
{source}
<?php
echo date("d/m/Y");
?>
{/source}


Have you an idea of the problem ?

Re: php code with sourcerer not evaluated in pdf

Posted: 27 Sep 2016, 16:16
by Jan
Can you link the created PDF so I can take a look at it.

The displaying of plugins works this way: Phoca PDF gets from Joomla! all the content including plugins - in case, there is a problem with the plugin, Phoca PDF tries to remove it (when disabled in Options) and then the output will be sent to the PDF. So in fact I will expect the opposite problem as you have - so the plugin will be transformed but not successfully removed when disabled in Options :idea:

Does the plugin works in other parts of the system (try to test it in module - custom html - with enabled option to accept content plugins)

Jan

Re: php code with sourcerer not evaluated in pdf

Posted: 30 Sep 2016, 15:29
by stephen3179
I can't link the created PDF beacuse i work in local, but you can do the test yourself, it's easy and fast :

1- download the latest free version of sourcerer here : https://www.regularlabs.com/extensions/sourcerer
2- verify the order of system pluglin (sourcerer = level 0, phoca pdf system plugin = level 1)
3- copy and paste this code in a article :

Today :
{source}
<?php
echo date("d/m/Y");
?>
{/source}

4- verify the views with the urls i have used :
article view : index.php?option=com_content&view=article&id=(id of your article)
pdf view : index.php?option=com_content&view=article&id=(id of your article)&format=pdf

Thank you again for your help, i hope you will find the problem because i haven't solution (except for leave phoca pdf and find an other plugin...)

Re: php code with sourcerer not evaluated in pdf

Posted: 03 Oct 2016, 13:14
by Jan
Hi, I now see it, this plugin is not a content plugin but system plugin. PDF document gets the article content including content plugins not including system plugins. System plugins change the output at the end of processing the page. So try to ask the developer if there is no possibility to run is a content plugin?

Jan

Re: php code with sourcerer not evaluated in pdf

Posted: 28 Oct 2016, 17:44
by stephen3179
Ok thank you for your analysis, i contacted the developer who made the correction. It's now ok :-)

Re: php code with sourcerer not evaluated in pdf

Posted: 28 Oct 2016, 19:00
by Jan
Ok