[pmwiki-users] Re: recipe programming special markup

Karl Loncarek dh2mll at web.de
Sun Sep 11 15:55:58 CDT 2005


OK, now this markup (as result of this thread)
(or code example)

	Markup('test', '<include', '/^.*(\(:nl:\)|header:\\)|\n)((!{1,6})|
(====+)).*$/se', "Somefunction(\$pagename,PSS('$0'))");

Somefunction ($pagename,$text) {
    	global $InclCount;
 	if ($InclCount > 0) {//avoid running when files are included, 
    	    	    	    	  //e.g. on Sidebar loading
		return $text;
      }

    echo "Some Text";

}

So the above markup runs before including files and gives the whole text 
of the wikipage as result.

I intended to run somefunction only once, but it is run twice. Can anyone 
tell me why? 

Of course I could get around this with a global counter variable, but I 
wanted to avoid this (It does work but is IMHO not really elegant) and I 
want to learn...

-- 
Bye
Karl (aka Klonk)





More information about the pmwiki-users mailing list