Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Variables from config.php available in Code Library?

Post Reply
FBC-Tim
Posts: 25
Joined: Thu Jun 23, 2011 6:08 am

Variables from config.php available in Code Library?

Unread post 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?
pickle_jimmy
Posts: 38
Joined: Mon Jul 25, 2011 4:00 am

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

Unread post 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
Post Reply