[pmwiki-users] Data storage project

The Editor editor at fast.st
Mon Jul 31 10:43:34 CDT 2006


Hi all,

Several people have made helpful suggestions for getting the page
variables set in my data storage project, but nothing seems to work.
Here's the complete read markup and function, hoping SOMEONE can spot
what's missing:

# Directive to retrieve data from another page
Markup('fastdata', '_begin', '/\(:data(.*?):\)/ei', "ReadData('$1')");
 //  (:data Group.Name:)

# Function called by directive to retrieve form data
function ReadData($l) {
 global $WorkDir;
 $datapage = substr($l, 1);
 clearstatcache();
 if ($dr = fopen("$WorkDir/$datapage", "rb")){
       $pc = fread($dr, filesize("$WorkDir/$datapage"));
   fclose($dr);
       $dc = explode("(:comment data:) %0a%0a", $pc);
       $db = explode(" %0a%0a", $dc[1]);
       foreach ($db as $df) {
               $dv = explode ("=", $df);
               $f = "\${$dv[0]}";  //also "$$dv[0]" seems to work
               $v = $dv[1];
               $FmtPV['$f'] = $v;  //problem seems to be here
		return "$f + $v + $FmtPV[$f] + $FmtPV[$profile]";  // used for debudding
               }
       return;
 }
 return "data not found";
}

I know it's reading the data, because it will return appropriate
values for $f ($profile) and $v (Caveman), from my data page, and even
$FmtPV[$f] (Caveman).

But for some reason, $FmtPV[$profile] returns nothing, and
$FmtPV['$profile'] locks up the page (white screen).  In other words,
though $f="$profile", $FmtPV[$f] != $FmtPV[$profile].

To make a long story short, as a result {$profile} returns nothing in
the page.  :(

Can anyone help with this?

Cheers,
Caveman




More information about the pmwiki-users mailing list