Hi there,
I have the following functions which translate and load the values from 2 separate language files (.txt files):
/*function load a file into a dictionary*/
function loadDictionary($fileName){
$dictionary = array();
$fh = fopen($fileName, "r");
while($line = fgets($fh, 1024)){
//trim the line
$line = trim($line);
if(strlen($line)==0 || $line[0] == '#'){
//skip empty lines and comments line
continue;
}
//asign key&value
list($key, $value) = split("=", $line);
$dictionary[trim($key)] = trim($value);
}
fclose($fh);
return $dictionary;
}
/*display a dictionary*/
function printDictionary($d){
foreach($d as $key => $value){
echo("$key ==> $value\n<br>");
}
}
/*display a single key*/
function trad($dictionary, $key){
return $dictionary[$key];
}
//load the dictionary
$language = getLanguageSite();
$file_name = WEB_ROOT . "/dictionaries/" . $language->language . ".txt";
$dictionary = loadDictionary($file_name);
My problem is, that if I try to use the = sign in one of my language text files, it is parsed by PHP when the file is loaded, and I don't want that. For instance in I have
<font style="color:#FF3300">How are you</font>
php parses the = sign and it stops right there. I tried using & # 6 1 ; (without spaces of course) but I am not getting any result expected (red font).
How can I modify the above functions so that php avoids parsing the = sign in my language files ?
Thank you kindly.