[pmwiki-users] Data storage recipe
The Editor
editor at fast.st
Wed Jul 26 20:31:37 CDT 2006
Hi Late Night Coders,
In an effort to try and tinker along forwards on my data storage
project, I narrowed down the following function in buildforms to be
the one that saves the data.
function BFrmSavePars() {
global $BFrmRdPar, $WorkDir, $pagename;
if ($fp = fopen("$WorkDir/$pagename-val", "wb")){ //save again parameters
foreach ($BFrmRdPar as $key=>$dt) {
$str = myaddslashes(str_replace ("\r", '', trim($dt['value'],'"')));
$str = str_replace ("\n", '`', $str);
fwrite($fp,"$key:$str\n");
}
fclose($fp);
}
}
Below is my rewrite of it to try and save the data in a standard wiki
format modeled on other recipes.
function BFrmSavePars() {
global $BFrmRdPar, $WorkDir, $pagename;
foreach ($BFrmRdPar as $key=>$dt) {
$str = myaddslashes(str_replace ("\r", '', trim($dt['value'],'"')));
$str = str_replace ("\n", '`', $str);
$out = $out + "$key:$str\n";
}
WritePage($pagename,$out);
}
I've also tried
FmtPageName($out,$pagename); and
MakePageName($out,$pagename);
All three seems to work when I enter the data in the form, but no page
is created. Evidently I missed something. Any suggestions?
Cheers,
Caveman
More information about the pmwiki-users
mailing list