I have the following code:
function Parse_Config($file, $conf_type='text') {
if ($conf_type=='text'){
$fp = fopen($file, 'r');
if($fp) {
while(!feof($fp)) {
$line = fgets($fp, 4096);
$conf_name = trim(strtok($line, '='));
$conf_value = trim(strtok(''));
// use dynamic variable name
global $$conf_name;
// cast bools
if(strtoupper($conf_value) == 'FALSE') {
$conf_value = false;
}
elseif(strtoupper($conf_value) == 'TRUE') {
$conf_value = true;
}
$$conf_name = $conf_value;
}
}
}elseif($conf_type == 'php'){
include("http://www2.pharm.ku.edu/pages/conf/oee_log_TEST.conf.php");
print "$page_type ".$page_type;
}
}
and oee_log_TEST.conf.php:
<?php
//ku_pagetitle=Office of Experiential Education
//ku_rightnav=rightnav_oee.php
//page_type=php
global $ku_pagetitle;
global $ku_rightnav;
global $page_type;
$ku_pagetitle='Office of Experiential Education';
$ku_rightnav='rightnav_oee.php';
$page_type='php';
?>
Even though the variable $page_type is set in oee_logTEST.conf.php the functions does not recognize it. Why is that? And is there a way to get the function to recognize the variable?