[pmwiki-users] Is there a way to display the number of revisions for a page?

Jonathan Scott Duff duff at pobox.com
Sat Jan 29 22:52:38 CST 2005


On Sat, Jan 29, 2005 at 08:10:29PM -0800, Noel Llopis wrote:
> I'd like to indicate how many revisions a page has gone through (I find it's 
> a very good indication of how busy the page has been and it's quite 
> useful). Is there a way to do that with PmWiki? I've looked through the 
> available variables but didn't see anything about that.

There's probably a better way to do this, but here's a quick bit of
code that you can add to local/config.php to obtain some markup that
will display the number of revisions a page has had:


Markup('showrev','inline','/\{\$Rev\}/e','ShowRev($pagename)');

function ShowRev($pagename) {
  Lock(1); $page = RetrieveAuthPage($pagename, "edit"); Lock(0);
  if (!$page) { Abort("?cannot get $pagename"); }
  return $page['rev']+0;
}

After you've added the above to your config.php, you merely have to
include the text {$Rev} somewhere in your page to get the number of
revisions.


-Scott
-- 
Jonathan Scott Duff
duff at pobox.com



More information about the pmwiki-users mailing list