[pmwiki-users] processing order
marc
gmane at auxbuss.com
Tue Feb 19 03:35:39 CST 2008
Peter & Melodye Bowers said...
> > Peter & Melodye Bowers said...
> > > Is there any kind of situation in which directives (like markup
> > expressions)
> > > get processed twice in a single browse of a page? Or (more surprising)
> > that
> > > echo statements could somehow be suppressed during an earlier invocation
> > of
> > > the MX?
> >
> > Have you followed the instructions from:
> >
> > /PmWiki/CustomMarkup
> >
> > The problem might also stem from the format of the content you are
> > returning to PmWiki - whether it is markup, a directive, HTML, etc. -
> > where Keep($result) might be necessary.
> I have confirmed that the markup expression I am working is indeed being
> called twice. I had to put debugging statements in including microtime()
> output and run it on a slower computer to be able to catch (via a quick
> printscreen) a flash of debugging (echo) output. This flashes by (on the
> slow computer -- too fast to catch on a faster computer) and is immediately
> replaced by almost identical debugging output.
Rather than using echoes - which are generally fine - have a look at
error_log(). Might help your sanity ;-) Alternatively, write a debug
recipe that writes to a wiki page; that's the method I use for sites,
with notify on the page to email those interested.
Something like this should get you started (I think it will work in
PHP4; I've tried to strip out the PHP5 stuff that I use):
# singleton, use PmWikiError::getInstance()->postError(...);
Class PmWikiError {
var $pageName;
function PmWikiError($pagename) {
$this->pageName = $pagename;
}
function getInstance ($pagename='Site.ScriptErrors') {
static $pmwikierr = null;
if (! isset($pmwikierr) )
$pmwikierr = new PmWikiError($pagename);
return $pmwikierr;
}
function postError($error) {
global $Now, $IsPagePosted, $FarmD;
include_once("$FarmD/scripts/notify.php");
$page = ReadPage($this->pageName);
$page['text'] = strftime('%a, %d %b %y @ %H:%M:%S', $Now)."\\\\\n".
$error."\n\n".$page['text'];
WritePage($this->pageName,$page);
$IsPagePosted = true;
PostNotify($this->pageName,$page,$page);
}
}
> By carefully comparing the
> microtime() timestamps on my printscreen version to the final version it is
> clear that they are 2 separate invocations. I then put debugging in
> MarkupExpression() (in scripts/markupexpr.php) with the same sort of
> microtime() debugging and confirmed that MarkupExpression() itself is being
> called twice.
>
> Any idea how this could happen? How do echo statement outputs get cleared
> from a screen?
Redirect()?
> How does MarkupExpression() get called multiple times when
> there's only one call? I'm sure it's something I'm doing, but I don't have
> a clue where to look...
>
> Is it possible that pmwiki might process through a page once and then "look"
> at the output of that run-through again to see if there are any further
> markups that need to be processed recursively? I'm shooting in the dark
> here, but that would make sense if that's what it does... (I don't see any
> markup in the results -- I'm coming up with a pretty blank page actually,
> but at least it would give me something to point at...)
It sounds like Redirect() behaviour to me.
--
Cheers,
Marc
More information about the pmwiki-users
mailing list