Can we use include in PHP/JS of forms, lists, ...?

You can include files from your eval'ed PHP (or PHP files), yes. There's no set location, you just specify the path as usual in PHP's 'include' or 'require' command. I usually create a folder, like ./components/com_fabrik/includes, and put them in there. Or I might put them in the same folder as the related code, which might be (say) ./plugins/fabrik_form/php/scripts, or whatever.

Likewise any additional JS you might need. If it's a 3rd party library, I'll usually put it in the main Fabrik ./components/com_fabrik/libs folder, then (if I'm using it on a form) I'll load it using a PHP plugin using the 'on load' hook, and add it to the list of JS to load on the page using ..

Code:
$document = JFactory->getDocument();
$document->addScript('/path/to/your/script.js');

This adds the script to the list that Joomla will include in the 'head' section of the page, so it's then available for you to use in any of your custom JS.

For lists, there isn't (at the moment) a convenient plugin to use to add the script declaration, so the best way of doing it is to create a custom template, and add the above lines of PHP at the top of the main default.php.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top