Forum Moderators: coopster
I need something very basic that will let me easily edit my content rather than having to edit html files manually.
I've tried hotscripts.com and could seem to find anything.
Any suggestions would be appreciated.
Cheers
Linda
[sourceforge.net...]
The best part is it creates search engine friendly URL's
They are all based on mySQL but it is easy to install it on Windows system and PHP can be added as a ISAPI to IIS
Luck
{totally untested code for illustrating concept only - but it was fun to write!}
<?php
function my_file_query($sql)
{
$s=explode(" ",$sql);
switch $s[0]
{
case "INSERT" :
{
if ($s[1]!="INTO") return "INSERT must be followed by INTO";
$file=str_replace("`","",$s[3]).".txt";
if (!($handle=fopen($file),"a") return "INVALID 'table' $s[3]";
$a=2;
while($s[$a]!="VALUES") $fields.=$s[$a++];
$a++;
while(($b+$a)!=(sizeof($s)+1)) $values.=$s[$b++];
$fields=explode(",",str_replace("`","",$fields));
$values=explode(",",str_replace("'","",$fields));
$a=0;
fwrite($handle,"¦¦¦");
while($a<sizeof($fields)) $writerecord.="¦$fields[$a]=$values[$a]";
fwrite($handle,$writerecord."¦¦¦");
fclose($handle);
}
break;
//add more select clauses
}
}
?>
SELECT:
<?php
//into the my_file_query
case "SELECT" :
{
global $myremaining;
global $myqueries;
$a=1;
while($s[$a]!="FROM") $fields.=$s[$a++];
$a++;
$file=str_replace("`","",$s[$a]).".txt";
if (!($handle=fopen($file),"a") return "INVALID 'table' $s[$a]";
$resourceid=sizeof(myqueries);
$myremaining[$resourceid]=fread($file,sizeof($file));
$myqueries[$resourceid]=implode(" ",$s);
return $resourceid;
break;
}
//for eg a my_file_fetch_row
function my_file_fetch_row($resourceid)
{
global $myqueries;
global $myremaining;
preg_match("/^"./*parse the query string ($myqueries[$resourceid]) for the WHERE clause*/."$/",$myremaining[$resourceid],$match);
//parse $match[0] for the field=result¦ from the fields list
$myremaining[$resourceid]=substr($myremaining[$resourceid],strlen($match[0]));
return /*the results from the parsing for field names*/
}
?>