As I found thousands of sample how to use ereg, replace and file functions, but no proper
answer on how to edit a config-file (I became too so lazy to manually edit all this stuff :)), I
wrote some code myself and the first part is here.
$strOldContent = file ($strCfgFile);
$strNewContent = "";
while (list ($intLineNum, $strLine) = each ($strOldContent))
{
if(!eregi("^//",$strLine)) // dont show any line commented with //
{
if(eregi("^\\$".$strCfgVar."( |\t)*=",$strLine)) // show any line beginning with a $
{
$strLineParts=explode("=",$strLine);
// here we should have to determine type of value! (BOOL, INT or String)
echo "<pre>The value for <b>$$strCfgVar</b> has been replaced with <b>$strCfgVal</b> in
File <b>$strCfgFile</b></pre>";
?>
----- End CUT ----
As I did not have the time yet to explore all power of regular expressions, I dont mind, a Guru
finding a more elegant solution for the first two ereg-statement to merge them.
Otherwise, this little script will end up in a complete app, with which one can (finally) simply
configure and setup all kind of php-apps, which require many times heavy editing.
The full version will include form-based editing. Any comments are very welcome, esp. hints, if
such script already exists (could save me more time ;)