[pmwiki-users] Markup Processing Order

The Editor editor at fast.st
Sun Aug 20 16:03:09 CDT 2006


Hi Patrick!

Thanks again for the very encouraging help!  I decided to try for your
second option as it seems more efficient to just process one small
input string, one time, than to redo the whole page through several
steps of processing.

However, it didn't work.  I've tried tinkering around with your code
several different ways with no real results.  Here is the recipe as of
my last attempt to process (:data Group.{$Name}:)

# Directive to retrieve data from another page
Markup('fastdata', '<{$var}', '/\(:data(.*?):\)/ei', "ReadData('$1')");

# Function called by directive to retrieve form data
function ReadData($l) {
  global $WorkDir, $FmtPV;
// print "datapage=$l;
  $l = substr($l, 1);   // this gets rid of single blank space at beginning
      $l = preg_replace('/\\{(!?[-\\w.\\/]*)(\\$\\w+)\\}/e',
       "htmlspecialchars(PageVar(\$pagename, '$2', '$1'), ENT_NOQUOTES)");
//  print "datapage=$l";
  return
}

Actually there's more but this works, for debugging.  When I uncomment
the two print lines I get Group.{$Name} for the first $l and blank for
the second.  If I switch the order to >{$var} I get Group.Page for the
first $l and blank for the second. Either way the two lines of code
you gave me seem to convert my input string to a blank.  I'm
struggling to make heads or tails of those two lines of code, so can't
really begin to guess where the problem might be.  Any suggestions?  I
tried cutting and pasting straight from stdmarkup but there were no
typos that I could spot.

While I am at it, on my editing software I can't tell the difference
between an $l (letter) and a $1 (number).  Right now I have all of
them in this code set to "L's" except for the #1 in the Markup line
and the #1 in the htmlspecialchars line.  Also, are those two lines of
code you supplied supposed to be one line? Or is there a hard line
break there in the middle?  I tried both ways, but neither seemed to
make a difference.

Cheers,
Caveman



On 8/20/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> Or, you can leave it set to '<{$var}', and have your ReadData
> function do page variable substitutions on the parameter before
> opening the appropriate page or file.  Thus:
>
>     # Function called by directive to retrieve form data
>     function ReadData($l) {
>       global $WorkDir, $FmtPV;
>       $l = preg_replace('/\\{(!?[-\\w.\\/]*)(\\$\\w+)\\}/e',
>         "htmlspecialchars(PageVar(\$pagename, '$2', '$1'), ENT_NOQUOTES)");
>       $datapage = substr($l, 1);
>       if ($dr = fopen("$WorkDir/$datapage", "rb")){
>         $pc = fread($dr, filesize("$WorkDir/$datapage"));




More information about the pmwiki-users mailing list