Go configure????? Pros/Cons of a config file?
Posted: Sun Nov 14, 2004 9:03 pm
Hello,
Is this a proper way to write/handle a config file:
I would then call it like this:
And from there, I use the config vars like so:
If my syntax is correct, what are the benifits of using a config file in this way? It seems like a lot of extra code for just declaring global variables? Does anyone have examples of config file coding-formats that they use?
I am not using a mySql DB, does that matter?
Thanks!
Cheers
Micky! ;D
Is this a proper way to write/handle a config file:
Code: Select all
<?php
/********************\
|* config.inc.php *|
\********************/
// Location and name of folder to create quotes/bids (no ending /, example: "./some_dir/some_dir":
$config['q_fldr_loc'] = './clients';
// Extension of file to create:
$config['doc_type'] = '.php';
// Location to file managing script:
$config['file_mng'] = './mng_files.php';
?>Code: Select all
<?php include_once($_SERVER['DOCUMENT_ROOT'].'/quotes/inc/config.inc.php'); ?>Code: Select all
...
...
...
$fp = fopen($config['q_fldr_loc'].'/'.$file_name.'/'.$qfname.$config['doc_type'],'wb'); // Open for writing only; If the file does not exist, attempt to create it.
fwrite($fp,$contents);
fclose($fp);
echo "<p>Your $".$en_form_num." quote/bid for ".$company." has been generated, <a href='".$config['q_fldr_loc']."/".$file_name."/".$qfname.$config['doc_type']."'>click here</a> to scope it!</p>"."\n";
echo "Or, <a href='".$config['file_mng']."'>click here</a> to manage/remove directories.";
...
...
...I am not using a mySql DB, does that matter?
Thanks!
Cheers
Micky! ;D