[pmwiki-users] <!--function:

Patrick R. Michaud pmichaud at pobox.com
Sun Dec 11 09:49:09 CST 2005


On Sun, Dec 11, 2005 at 04:44:48PM +0100, Tomas Pihl wrote:
> I've created the markup:
> 
> Markup("count", "inline", "/\.\.(.*?)\.\./", "<!-- 
> function:DisplayCommentsCount($1)-->");
> 
> When using this on a page sunch as "This is some text ..Blog.Today..  
> and so on", the resulting HTML has the HTML-comment in there but I  
> thought Pmwiki would replace it with the result of the functioncall.  
> I might have misunderstood this completly or?

The HTML comments only work in skin template files, not in markup.  

> How would one do to have a function called from any page, sending in  
> the pagename as argument?

    Markup("count", "inline", 
      "/\\.\\.(.*?)\\.\\./e",
      "DisplayCommentsCount(PSS('$1'))");

The "/e" says to execute the replacement rule rather than substitute
text.  The PSS function gets rid of the funny backslash quoting that PHP 
likes to put into captured values (if you know the capture value won't 
contain quotes or backslashes, then you can just use '$1' instead).

Pm





More information about the pmwiki-users mailing list