Buy Now
Sign in

include php file

dench , January 06 at 15:44
Hi and happy new year to all !

I am a joomla user of chronoforms V4, I already have found how to include JS scripts inside the code of my forms, for example :
  $doc =& JFactory::getDocument();
  echo nextend_smartslider3(8);
......... and then the code...........

You can see that my JS_File (shooting_test.js) is in a folder inside my root, that is very useful when I decide to edit my JS script without opening chronoforms

But I did not find how to include PHP files the same way...

Here is an example of code that I use in the events of a form for sending an email to someone after a submit button :
( The php section is to check wether the customer do have a valid coupon code )
$source = file_get_contents('');
$data = json_decode($source, true);
if (array_key_exists($code_coupon, $data)) {
  $prixEffectifTexte=number_format(($prixEffectif), 2)." €";
} else {
  $prixEffectifTexte=number_format(($TotalCommande), 2)." €";
<h2 style="text-align: left; font-family:Sniglet,tahoma; font-size:12px;font-weight:bold;">
Hello <span style="color: #B99676;">{Prenom}</span>, <br />
Ceci est ton <span style="color: #BB1D56;">Bon de Réservation </span> pour la Séance-Photo que nous avons prévue pour le <span style="color: #BB1D56;">{Date1}</span> à <span style="color: #BB1D56;">{Heure1}</span><br />

So, you surely understand that I would love to have something like :

Do you think this is possible ?

Thank you very much by advance for your response and please forgive me for my english ☺
Hi Dennis,

You can include a PHP file from a Custom Code action (and some others). Here is the code I used for CFv4
include (JPATH_SITE.'/components/com_chronoforms/includes/'.$form->form_details->name.'/file_name.php');
You can change the file path to suit your needs.

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much