[pmwiki-users] PHP enumeration problem...

The Editor editor at fast.st
Tue Aug 22 11:45:16 CDT 2006

Hi all!  Still working at the FAST Data Project, trying to add another
great feature or two.

Right now I'm trying to set up an enumeration scheme to allow for
things like numberd forum threads, or issue tracking like PITS.  It
seems to be working properly except for line 3. I've been working on
the expression matching for hours, reading, trying to figure it out.
But I'm stumped  Here's the recipe and my comments what each line
should do.  Using various error checking methods I've determined line
3 is returning no matches though some exist. I've also been able to
ascertain pretty confidently every other part of the recipe is doing
what it is supposed to.

case "DataPage" :
1	if (substr($value, -2, 2) == ".#") {
2		$g = substr($value, 0, strlen($value)-2);
3	        foreach(ListPages("^\$\g\.[0-9]$") as $n) {
4			$n = substr($n,strlen($g));
5			$count = max(@$count,substr($n,strlen($group)+1));
6			}
7		$value = $g . "." . $count;
8		}
9  	$datapage=FmtPageName($value, $pagename);
10	break;

1. Checks the DataPage value to see if it ends in ".#"  Setting the
DataPage to Group.# triggers the optional enumeration scheme.
2. Returns $g, just the group name.
3. Here is my problem--it's supposed to return all the pages in the
given group with numbers for names, i.e. "Group.1234" or "Group.2374"
4. This returns just the number part of the page name.
5. This sets the count to one above the highest page number in the group.
7. Resets the datapage value to the new number (i.e. Group.2375).

Can someone help me out with the expression matching, or suggest a
good tutorial?


More information about the pmwiki-users mailing list