FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pre-parser php library
#1
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
Reply
#2
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__);
exit; 

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");
include(
$include_file_location); 

The realpath function will convert that whole shebang into a valid file path.

Hope this helps.

- Ben
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)