[pmwiki-users] best practice

John Rankin john.rankin at affinity.co.nz
Tue May 9 16:40:14 CDT 2006


On Tuesday, 9 May 2006 9:05 PM, Marco Ferretti <marco.ferretti at gmail.com> wrote:
>Hi all.
>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 ), but I am stuck as of the 
>initialization  ( getting the last doc number when the web-server is 
>started ... ) .
>
>Do you have any suggestion/ better approach ?
>
>TIA
>
I have just done something similar, but can't show you because it's on
a secure site. We do the following:

- each document is yyyymmdd-suffix -- the suffix is A-Z as there will not 
  be more than 26 on any given day

- a form creates a new page for the next document on a given day -- fill 
  in yyyymmdd and it takes you to the page with the next available suffix; 
  this is done with a call to pmwiki's PageList function that looks for 
  pages of the form "group.date-?" and extracts the maximum value of "?"

- on each page, there is a navigation bar A | B | C? where the last item 
  in the list is a link to the next available document page for that day

- it automatically applies a title "dayname, dd monthname yyyy (suffix)" 
  to document pages

Your case is simpler, in that you want to use a year with a numeric 
suffix, so you don't need the extra complexity of working out a letter 
of the alphabet, you just increment the maximum number found by 1.

If something like this might be suitable, I can send the code. If not,
perhaps it will give you some ideas.


-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list