Hi all,
I am using wayfinder 2.0 on evo.
I want to create a menu that displays the start item and places a small image in front of the active item.
So I created a hereTpl and a startItemTpl. I use a table to put them in to align them nicely and display a top line above each item, and add a empty field last to create the feeling every field has a top and bottom line.
I also added a little bit of code to the snippet, to have an extra parameter to let wayfinder travel up as long as a document has a parent. On this way I always have the same view of wayfinder on whatever subitem I am.
The problem is that the start item does not get the image, while any other selected item does get it. Does anyone know how I can solve this?
Here are my templates:
rowTpl:
<tr>
<td align="center" > </td>
<td><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></td>
[+wf.wrapper+]
</tr>
hereTpl:
<tr>
<td align="center" ><img src="assets/images/pijl.gif" alt="pijl"></td>
<td><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></td>
[+wf.wrapper+]
</tr>
startItemtpl:
<tr>
<td align="center"> </td>
<td><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></td>
[+wf.wrapper+]
</tr>
Custom code:
//extra part to travel up to start id that doesnt have a parent. need $extra=1 to be used
if($extra == 1) {
$id = $startId;
$parent = $modx->getParent($id, 0, 'id');
if($parent['id'] != "") {
$loop=true;
while($loop) {
if($modx->getParent($parent['id'], 0,'id') != "") {
$parent = $modx->getParent($parent['id'], 0, 'id');
}
else {
$loop = false;
}
}
}
else {
$parent['id'] = $id;
}
$startId = $parent['id'];
}
finally my wayfinder call:
[!Wayfinder? &startId=`[*id*]` &extra=`1` &outerTpl=`wfoutertpl` &rowTpl=`wfrowtpl` &startItemTpl=`wfstartitemtpl` &hereTpl=`wfrowheretpl` &level=`1` &displayStart='TRUE' &parentRowHereTpl=`wfparentrowheretpl` !]
Thanks in advance,
Jurrian