chris.paschen
Chris Paschen
I know I'm probably pushing the limits with fabrik with this - but I thought I'd ask.
I have a form with several similar items that all have the same calc element calculation in them - a rather lengthy bit of code that is a bit of a pain to maintain - because it's in several different calc elements - requiring me to update each of those elements every time I need to make a change to the calculation during development.
I had this brainstorm idea that it would be easier if I could just 'include' (or 'require') an external library file that had a function in it that the calc could call - that would allow me to just maintain the logic in one library file, rather than in several different calc elements. In addition, it would allow me to create a 'calc library' of various functions that I might use across different forms and even sites.
HOWEVER, when I try to use the 'include' or 'require' line like this:
at the head of the calc area, the resulting form (on the admin-side at least) just gives a 'white screen'.
I'm guessing that the calculation code is not just plain PHP, but is in somehow parsed and is not able to handle include/require. Or that there's some sort of processing order problem in the way the calc is implemented.
Has anyone else very tried something like this?
If it worked it would open up a huge possibility of extending the functionality of fabrik elements (esp. calc elements) without needing to modify the core of fabrik.
I have a form with several similar items that all have the same calc element calculation in them - a rather lengthy bit of code that is a bit of a pain to maintain - because it's in several different calc elements - requiring me to update each of those elements every time I need to make a change to the calculation during development.
I had this brainstorm idea that it would be easier if I could just 'include' (or 'require') an external library file that had a function in it that the calc could call - that would allow me to just maintain the logic in one library file, rather than in several different calc elements. In addition, it would allow me to create a 'calc library' of various functions that I might use across different forms and even sites.
HOWEVER, when I try to use the 'include' or 'require' line like this:
PHP:
require JPATH_LIBRARIES.'/pc/fabrik/functions.php';
I'm guessing that the calculation code is not just plain PHP, but is in somehow parsed and is not able to handle include/require. Or that there's some sort of processing order problem in the way the calc is implemented.
Has anyone else very tried something like this?
If it worked it would open up a huge possibility of extending the functionality of fabrik elements (esp. calc elements) without needing to modify the core of fabrik.