are the variables in config.inc GLOBAL?OK, I wasn't very explicit as to what I was actually trying to do earlier, so here's what's happening.
I am trying to create a site template that I can use for almost all of my projects by creating a series of files that link into one configuration file.
The current layout looks like this:
/index.php | -----> require_once("site_fns.inc.php") | ------->require_once("includes/config.inc.php"); require_once("includes/database_fns.inc.php"); require_once("includes/output_fns.inc.php");
config.inc.php contains the site wide variables in the following syntax:
$cfg['sitevars']['variable_name'] = "variable_value"; for all site variables such as the site title and the character set and $cfg['servervars']['variable_name'] = "variable_value"; for all server variables including database hosts, database names, usernames and passwords.
output_fns.inc.php contains all the functions to create the UI of the site, including the raw HTML output
database_fns.inc.php contains the functions to connect to the database and manipulate data
The problem I have is that the variables from config.inc.php are not
getting through to the functions in either of the _fns.inc.php pages. Is there a way around this?
TIA,
Matt
if not, you will have to include config.inc inside every function
or define them as global $cfg etc inside each function .
If you are using a newer version of PHP then try to make use of $GLOBALS array
in config.inc, declare the variables as
$GLOBALS["cfg"]["sitevars"]["variable_name"]=......
HTH R'twick
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]
