After diggin’ a little deeper with my very limited PHP knowledge...this is my solution:
I added a
'countFrom' =>isset($countFrom) ? $countFrom :FALSE,
to the config array in the Wayfinder snippet.
In the wayfinder.inc.php file I:
changed the ’rowLevel’ array to look like this:
'rowLevel' => array('[+wf.wrapper+]','[+wf.classes+]','[+wf.classnames+]','[+wf.link+]','[+wf.title+]','[+wf.linktext+]','[+wf.id+]','[+wf.counter+]','[+wf.attributes+]','[+wf.docid+]','[+wf.introtext+]','[+wf.description+]','[+wf.subitemcount+]')
hence adding a [+wf.counter+] placeholder into the row template
I created a cunningly named countUp function:
function countUp(){
global $modx;
$this->counter++;
return $this->counter;
}
In the renderRow function I added another if clause straight after the rowIdPrefix, nigh on duplicating it to use the countUp data which looks like:
if ($this->_config['countFrom']) {
$getCounter = $this->countUp();
while ($getCounter > $this->_config['countFrom']){
$getCounter = $getCounter - $this->_config['countFrom'];
}
$countUp=$getCounter;
} else {
$countUp = '';
}
I just need to amend the $phArray now to integrate my wf.counter placeholder at the right place, if you remember rightly we amended the rowLevel array at the top in a similar way, so now we add a $countUp array between the $useId and $resource[’link_attributes’] so now it looks like
$phArray = array($useSub,$useClass,$classNames,$resource['link'],$resource['title'],$resource['linktext'],$useId,$countUp,$resource['link_attributes'],$resource['id'],$resource['introtext'],$resource['description'],$numChildren);
In the wayfinder call I can now add a parameter &countFrom=`n` where n is where you want it to restart counting.
In my case I have 4 bg images and therefore &countFrom=`4` which I add to my config file to get it to load bg_image1 thru to bg_image4 hopefully ;-)
As already mentioned I have little PHP knowledge so don’t know about overheads and other pitfalls. One possible problem is if you have &level as anything but 1....I think it will count nested...but for my client I don’t need sub menus so I’ll cross that bridge when I come to it.
Cheers Helio for your help,
Taff