Get calc element code from txt file stored on server

Yes. Assuming you wrap the code in a function.

Code:
require_once('/full/path/to/your/file.php');
return yourFunc($data);

... and your file.php has a function that return whatever you need ...

Code:
function yourFunc($data) {
   // do whatever, probably involving $data
   return $whatever;
}

If you are going to need stuff from the Fabrik form (or list row), pass in that $data, and use it like you would in inline calc code. If not, leave it out.

-- hugh
 
What I typically do if I have a site with more than a few lines of custom code is to put everything in a class in one file, and anywhere I need to use it ...

Code:
require_once JPATH_ROOT . '/some/folder/mystuff.php';
$myClass = new myClass;
return $myClass->doSomething();

... or whatever. Putting your functions in a class is typically safer than just creating global functions.

At some point I'm probably going to add a standard way of including a user class for this purpose, so it'll just be there "as if by magic" in $formModel->userClass, or $listModel->userClass, etc.

-- hugh
 
Im trying to get the whole calc code from an external file from an usb, so to update the file i simply will switch the usb
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top