Quote from: coleh at Jul 04, 2008, 08:20 AM
I am using wayfinder (2.0) and want to employ it to generate a sitemap.
In this particular instance, there are some containers/folders in the site where I want to include the parent but not its children.
Now, if I want to include the list of projects in the wayfinder call but not the list of links is this achievable with wayfinder?
Have managed to provide a solution for this though did require some hacking of the Wayfinder snippet, so I thought would post here in case of interest to anyone.
The following hack relates to version 2.0 of wayfinder.
1. Add the following line to the
$wf->_config array in the wayfinder snippet: [tt]’ignoreKids’ => isset($ignoreKids) ? $ignoreKids : 0,[/tt] (line 42):
$wf->_config = array(
'id' => isset($startId) ? $startId : $modx->documentIdentifier,
'ignoreKids' => isset($ignoreKids) ? $ignoreKids : 0,
2. Insert the following lines to the
wayfinder.inc snippet file, replacing line 99 (currently [tt]$docInfo[’hasChildren’] = in_array($docInfo[’id’],$this->hasChildren) ? 1 : 0;[/tt]):
$ignoreKids = $this->_config['ignoreKids'];
$ignoreKids = explode(',',$ignoreKids);
$docInfo['hasChildren'] = in_array($docInfo['id'],$this->hasChildren) && !in_array($docInfo['id'],$ignoreKids) ? 1 : 0;
3. To ignore all children of a particular document container, when calling the Wayfinder snippet add the parameter [tt]&ignorekids=`X`[/tt] with X being a comma-separated list of those document containers whose children you want to ignore.
For example:
[!Wayfinder? &startId=`0` &level=`3` &ignoreKids=`75,77,90`!]
This will include documents 75, 77, 90 in the Wayfinder results but ignore any of their children
Have attached a zip file containing the ammended wayfinder.inc.php and wayfinder.snippet.php files.
Hope this is of use/help to others and if there is a better/quicker/more efficient way of doing this do let me know,
Cole