[pmwiki-users] best practice

Joachim Durchholz jo at durchholz.org
Tue May 9 04:44:56 CDT 2006

Marco Ferretti schrieb:
> I want to create a cookbook to keep track of internal documents. The ideal 
> toponomy of internal documents should be of the form yyyy-nnn where yyyy is 
> the year in wich the document is issued, and nnn is a counter. Also, in an 
> ideal world, nnn should be set by the system. Now, since I've seen a lot of 
> code in cookbooks to retrieve the current year and provided that a wiki group 
> would be created ( say for example InternalDoc ) , what would be the best 
> practice in order to keep track of the next available document number ?
> I was thinking of a group page ( maybe InternalDoc:InternalDoc ? ) where to 
> initialize a variable ( $LastDocNumber ),

It's probably best not to store the last known document number on a 
wikipage. Somebody might inadvertently modify it and screw up the scripts.

> I am stuck as of the initialization  ( getting the last doc number
> when the web-server is started ... ) .

You'd need that initialization every time pmwiki.php is started.

The next free number could be determined by enumerating all page 
numbers, checking each in turn for existence, until you find a free one.


1. I think PmWiki has a way to check the existence of a page without 
loading it. If not, you can always look at the wiki.d directory (but be 
warned that this may break once people get creative with wikistores).

2. There are better ways to find a free document number than checking 
each number. Feel free to ask for an algorithm.


More information about the pmwiki-users mailing list