[pmwiki-users] best practice

Ben Wilson dausha at gmail.com
Tue May 9 11:29:05 CDT 2006


I wrote an outline bank that based the number upon the number of
documents in the system. The documents are named "Group.00001" and
"Group.00002," and each wiki page corresponds to a document (e.g.
Group.00001 links to page Group.000001.(doc|wpd|pdf)).

   $pages = ListPages("/^$group\\.\\d/");
   $next_page_no = count($pages) + 1;
   # Alternatively, pull the last page and find out the "nnn" like:
   list(,$next) = split('-', array_pop($pages));

You would probably want:

   ListPages("/^$group\\.\\d{4}-\\d{3}");

On 5/9/06, 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
>
> Marco
>
> --
> You will be honored for contributing your time and skill to a worthy cause.
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>
>
>
>


--
Ben Wilson
" Mundus vult decipi, ergo decipiatur"




More information about the pmwiki-users mailing list