The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
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__);
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