[pmwiki-users] Markup Processing Order

The Editor editor at fast.st
Sun Aug 20 10:44:31 CDT 2006

Hi all,

Just discovered a serious glitch in the FAST Data Project recipe.
Urgent help needed!

I have a markup (:data Group.Name:) which pulls all the data fields
off a given wiki page and sets them as page variables.  Currently the
processing order is set to


It works perfect for normal uses.  The problem is, for some
applications I need this:

(:data Group.{$Name}:)

When I actually got around to trying some of these applications I
discovered it processes the data markup before translating $Name--thus
giving me error messages as it tries to fread from literal:

I tried setting it to


thinking this would then set all the variables just after {$Name}--and
it does gets rid of all the error messages--but too late to do
anything with the page variables!  That is, they show up blank,
because the function is run after all the $var's have already been
translated.  I guess it's a problem of the chicken or the egg.

Can someone offer a suggestion to help me through this perplexing
dilemna?  The only solution that presents itself to me is to somehow
modify stdmarkup so it runs some page variables early ($Name, $Group,
etc.), and the rest later, in two steps. Or perhaps adding a second
step just after $vars called $data with a code like $$Name to
distinguish from $Name, etc. Anything...  Hate to tamper with the
scripts but this is mission critical for me...  Thanks!


PS.  Here is the data retrieval function if it might help anyone:

# 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;
  $datapage = substr($l, 1);
  if ($dr = fopen("$WorkDir/$datapage", "rb")){
	$pc = fread($dr, filesize("$WorkDir/$datapage"));
	$dc = explode("(:comment data:) %0a%0a", $pc);
	$db = explode(" %0a%0a", $dc[1]);
	$i = 0;
	while ($i < count($db)-1) {
		$dv = explode ("=", $db[$i]);
		$FmtPV["$$dv[0]"] = stripslashes("$dv[1]");
		$i = $i + 1;
  return "data not found";

More information about the pmwiki-users mailing list