Just wanted to update this thread in the off chance anyone else was looking for this type of functionality.
Using the above logic for document hierarchy...
In my particular instance, the client wanted the ability to go from the last to the first article - a loop. So, I updated the
PrevJumpNext snippet to accommodate. I’m sure there is a more robust/efficient way to accomplish this but I thought I’d share with the community. (Gotta start somewhere I suppose.)
I created a var "loopDocs" of type boolean
* - loopDocs : Boolean : Last document displays next menu item that links to the first document (default 0)
Checked if it was getting set (false by default)
if( !isset($loopDocs) )
{
$loopDocs = 0;
}
Finally, I set up my function
// Looping
if ($loopDocs)
{
// check if we are at the start or end of documents
if ($current == ($limit - 1) )
{
$PJN_prevPlaceHolder = "<a href='/[~".$my_array[$prev]['id']."~]' class='previous'>".$prevSymbol.$prevText."</a>".$separator."<a href='/[~".$my_array[1]['id']."~]' class='next'>".$nextSymbol.$nextText."</a>";
}
if ($current == 1)
{
$PJN_nextPlaceHolder = "<a href='/[~".$my_array[$limit - 1]['id']."~]' class='previous'>".$prevSymbol.$prevText."</a>".$separator."<a href='/[~".$my_array[$next]['id']."~]' class='next'>".$nextText.$nextSymbol."</a>";
}
}
I placed my functions right above the "Last item" function:
// Last item
$PJN_lastPlaceHolder = "<a href='/[~".$my_array[$limit-1]['id']."~]' class='last'>".$lastText.$lastSymbol."</a>";
I call it like this within my template:
[[PrevJumpNext? sortBy=`menuindex` &sortHow=`ASC` &separator=` ` &displayTitle=`0` &displayTotal=`0` &displayIndex=`0` &nextText=`Next Article` &prevText=`Previous Article` &loopDocs=`1`]]
Now, when I am at the last article of my newsletter, instead of only the back button, I have both back and forward - and I can go from the last to the first document. (Or first to the last)