I'm looking to do this:
/* example filename: config_load.php */
$config_file = "c:\path\to\file.php";
function read_config($file = &$config_file)
{
$settings = array();
$doc = new DOMDocument('1.0');
$doc->load($file);
$xpath = new DOMXPath($doc);
$all=$xpath->query('appSettings/add');
foreach ($all as $setting) {$settings[$setting->getAttribute('key')]=$setting->getAttribute('value');}
return $settings;
}
/* end config_load.php */
So then when I actually call the file, it'd go like this -
require_once "config_load.php";
// $config_file = "c:\path\to\file2.php"; //could also do this
$config = read_config();
This way if I don't specify a file, it's going to read the default config file. I could also define $config_file anywhere before I make the function call. And someone without access to the config_load file need not worry about being able to load a different file, they can define it anywhere before they make the read_config() call.