prevNext not working properly

Hey,

I can’t get prevNext working properly. In my old site I used navigator, but it’s not available in modx 3. Maybe it could be done with wayfinder, which I use for menues too?

My problem:

I call the snippet via

[[!prevNext? &tpl=`prev-next`]]

(former call of navigator called the prev and the next separatly:

[[-- navigator? &rel=`prev`&template=`navigator_prev`&transcend=`1`&weblinkAction=`skip`]] [[-- navigator? &rel=`next`&template=`navigator_next`&transcend=`1`&weblinkAction=`skip`]] 

)

The template “prev-next” for prevNext is this:

<!-- Achtung, prevNext vertauscht prev und next! -->
<div id="navigator_prev">
[[+next.id:notempty=`
<a class="navlink_prev" rel="prev" type="text/html" href="[[~[[+next.id]]? &scheme=`full`]]"><< Zurück: [[+next.pagetitle]]</a>
`]]
</div>

<div id="navigator_next">
[[+prev.id:notempty=`
<a class="navlink_next" rel="next" type="text/html" href="[[~[[+prev.id]]? &scheme=`full`]]">Vorwärts: [[+prev.pagetitle]] >></a>
`]]
</div>

I know the parts look like they should be the other way round, but I think prev outputs next and vice versa.

It seems not to work along the document tree, and I tried to put menu-index in the document ascending, but prevNext doesn’t seem to use that too.

Any idea what goes wrong?

Kind regards
Andre

pdoTools is probably your friend here - it includes a snippet called pdoNeighbors

It definitely works in MODX3 and may be closer in functionality to Navigator.

1 Like