Page 1 of 1

Variables from config.php available in Code Library?

Posted: Mon Aug 29, 2011 7:47 am
by FBC-Tim
I have written a php function that sends a notification email when a certain edit form is saved. This function is saved in the Code Library so I can use it from any form as needed. The lines below show a snippet from my function ...

Code: Select all

  $mail->Host = "192.168.0.6";
//  $mail->Host = $NUSMTPHost;
I wanted to use the $NUSMTPHost variable from config.php so the host address is only set in the main config file. But I don't seem to be able to get this variable from inside my Library Code function. I tried putting the line require_once("config.php"); at the top of my function but this did not seems to work.

What am I missing here?

Re: Variables from config.php available in Code Library?

Posted: Tue Aug 30, 2011 2:25 am
by pickle_jimmy
Hi FBC-Tim,

I think your issue with the include has to do with the path of config.php; it is generally in the /db/site directory, whereas the majority of the code is in the /productionnu2 directory.

Without having the path in the require_once call, PHP is probably not finding config.php.

Hope this helps

Pickle Jimmy