The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
pre-parser php library - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16) +--- Thread: pre-parser php library (/showthread.php?tid=656) |
pre-parser php library - robkay - Apr 15th, 2010 If I wanted to use require_once('somelibrary.php') to include a library in a pre-parser rule but didn't want to use an 'html://' prefix to the file name then where would '/somelibrary.php' be in the formtools directory structure for example? The problem is you have to start changing the permissions in php.ini to access external files which I would rather avoid for my client. Can you even include libraries in the form pre-parser? Thanks in advance for any suggestions, Rob RE: pre-parser php library - Ben - Apr 18th, 2010 Hi Rob, Very good question. First off, you couldn't use an http:// URL, you can only use a server path to include files. Off the top of my head I don't know, but you could find out like this. Add the following into your rule: PHP Code: $folder = dirname(__FILE__); That will print the folder that the submission preparser code is running in. You can use that location to construct the path to your include file. e.g. if your folder was 3 folders up, then two folders deep, you could do something like: PHP Code: $include_file_location = realpath("$folder/../../../my/folder/filetoinclude.php"); The realpath function will convert that whole shebang into a valid file path. Hope this helps. - Ben |