In k2, we can get the previous item's title by $this->item->previousTitle;
.
How can I get the second previous item's title, i.e. the title of the previous item of the previous item?
Get the result of $this->item->id using sql query
/ Find the index of the current item
$current_index = array_search($current_id, $array);
// Find the index of the next/prev items
$next = $current_index + 1;
$prev = $current_index - 1;
<a href="<?php echo $array[$id + 1]; ?>">Next</a>
<a href="<?php echo $array[$id - 1]; ?>">Prev</a>