[pmwiki-users] best practice

Patrick R. Michaud pmichaud at pobox.com
Fri May 19 11:28:05 CDT 2006


On Fri, May 19, 2006 at 04:58:49PM +0200, Marco Ferretti wrote:
> 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
> [...]
> 
> so the $next shall contain 24 , but printing it out says 1 !
> 
> what am I doing wrong ??

Your pattern says to find all pages in the 'Ref' group that have
a name beginning with a digit (i.e., immediately after the dot).

None of the pages in your wiki.d/ directory have names beginning
with a digit.  (Some of them begin with 'R' and then some digits,
but none begin with a digit.)  So, $pages is coming back as
an empty array, and adding one to that results in one.

Pm




More information about the pmwiki-users mailing list