PHP execution error following save method

Status
Not open for further replies.

gilb33

New Member
Good morning,
Please excuse my bad English.
Under Joomla 5.0, in a Fabrik4 form I execute a PHP plug-ins which generates a PDF document with the TCPDF library.
If I include the PHP code in the "PHP code code to execute when sending the form" window, its execution gives me a fatal error (see attached screenshot)
On the other hand, if I declare the PHP code in a file, it executes perfectly. There is therefore a difference depending on the method of defining the PHP code to be executed in a plug-ins.
Sincerely
Gilbert
 

Attachments

  • Capture d’écran du 2024-02-03 10-22-23.png
    Capture d’écran du 2024-02-03 10-22-23.png
    91.5 KB · Views: 41
  • Capture d’écran du 2024-02-03 10-22-11.png
    Capture d’écran du 2024-02-03 10-22-11.png
    87 KB · Views: 38
Last edited:
Are you defining a class inside your php code? That would do it. With F4 we take all php code and encapsulate in a class so that it isolates the Fabrik code from anything you might be doing in your code. If you really need it in a class can you pull the class code out into a separate php file and then include it in the code you are running inside the "PHP code to execute when sending a form" window.
 
Good morning,
Thank you achartier for your response.
Indeed in the code, I define a class which explains the error and corresponds to your analysis.
You just have to know that, that's all, it's not a problem to put the entire code in a file.
Sincerely
Gilbert
 
In general, unless the php code is short and simple, it is always better to place it in a file. I have a folder on my sites called custom_scripts and in there I keep all of my custom code and reference it as need in the various places inside Fabrik. I also have this directory contained on git so I can track changes on it over time (and restore if I need to).

Glad you got it sorted.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top