Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$407 per month—let's make that $500!Learn more
The snippet pdoNeighbors displays the previous and the next resources.
It can display several neighbors at once, check their status (unpublished, published), and allows you to specify sorting.
You can display the previous / next resources based on «menuindex», publication date or other resource field.
Accepts all options of pdoTools (except chunks templates) and some of its own:
|&id||The current document||The resource ID, of which are displayed the neighbors.|
|&tplPrev||see below||Chunk reference to the previous document.|
|&tplUp||see below||Chunk reference to the parent document.|
|&tplNext||see below||Chunk reference to the following document.|
|&tplWrapper||see below||Chunk-wrapper for wrapping results. Uses placeholders:
|&toPlaceholder||If not empty, the snippet will save all data to the placeholder specified, instead of displaying the output with the snippet call.|
|&showLog||0||Display log information of the snippet. Only authorized in the context «mgr».|
|&loop||1||0/1: Hide/show neighbours first/last entry if at the end of list|
Default snippet displays the neighbors as they are in the resource tree, that is, based on «menuindex»:
By default, the neighbors are selected from the current document, but you can specify a different id:
[[pdoNeighbors? &id=`55` ]]
The snippet is perfect for displaying links to adjacent news items (it is best to sort by date of publication):
[[pdoNeighbors? &sortby=`publishedon` &sortdir=`asc` ]]