[pmwiki-users] best practice

Marco Ferretti marco.ferretti at gmail.com
Fri May 19 09:58:49 CDT 2006


On Tuesday 09 May 2006 18:29, Ben Wilson wrote:
> 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}");
>

There is something, in the first solution, that seems not to work for me.

I have done this : 
function getNextValue(){
  $group="Ref";
  $pages = ListPages("/^$group\\.\\d/");
  $next = count($pages) +1;
  return $next;
}

now, looking @ /var/www/pmwiki/wiki.d I see : 
-rwxrwxrwx  1 www-data root       564 2006-03-28 13:31 Ref.All
-rwxrwxrwx  1 www-data root       958 2006-03-28 15:39 Ref.CategoriesTemplate
-rwxrwxrwx  1 www-data root      2602 2006-03-28 14:14 Ref.PagelistSamples
-rwxrwxrwx  1 www-data root       578 2006-03-28 13:21 Ref.R001
-rwxrwxrwx  1 www-data root       944 2006-03-28 15:33 Ref.R002
-rwxrwxrwx  1 www-data root      1083 2006-03-28 14:26 Ref.R004
-rwxrwxrwx  1 www-data root      1158 2006-03-28 15:26 Ref.R005
-rwxrwxrwx  1 www-data root      1396 2006-04-03 17:45 Ref.R006
-rwxrwxrwx  1 www-data root      1179 2006-03-28 15:55 Ref.R007
-rwxrwxrwx  1 www-data root      1086 2006-03-31 14:35 Ref.R008
-rwxrwxrwx  1 www-data root       838 2006-04-03 17:56 Ref.R009
-rwxrwxrwx  1 www-data root      1031 2006-04-04 14:46 Ref.R010
-rw-rw-rw-  1 www-data root      1025 2006-04-15 01:30 Ref.R11
-rw-rw-r--  1 www-data www-data   918 2006-05-12 12:39 Ref.R22
-rw-rw-r--  1 www-data www-data  1682 2006-05-12 12:39 Ref.RecentChanges
-rwxrwxrwx  1 www-data root     20746 2006-03-28 14:41 Ref.Ref
-rwxrwxrwx  1 www-data root       384 2006-03-28 15:22 Ref.RefCat1
-rwxrwxrwx  1 www-data root      8857 2006-03-28 15:38 Ref.RefControl
-rwxrwxrwx  1 www-data root      4804 2006-03-28 15:43 Ref.SideBar
-rwxrwxrwx  1 www-data root       848 2006-03-28 14:46 
Ref.Sidebar,del-1143549989
-rwxrwxrwx  1 www-data root      2287 2006-03-28 14:47 
Ref.Sidebar,del-1143550304
-rwxrwxrwx  1 www-data root      1745 2006-03-28 14:00 Ref.Template
-rwxrwxrwx  1 www-data root       826 2006-03-28 13:59 Ref.Test2

so the $next shall contain 24 , but printing it out says 1 !

what am I doing wrong ??

TIA

Marco

-- 
Q:	What's the difference between an Irish wedding and an Irish wake?
A:	One less drunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/pmwiki-users/attachments/20060519/8a2f04ff/attachment.bin 


More information about the pmwiki-users mailing list