I was wondering if anyone could help me generate previous/next buttons based on an array of all items.
This is my basic array:
Array
(
[0] => stdClass Object
(
[id] => 1
[name] => ITEM 1
)
[1] => stdClass Object
(
[id] => 5
[name] => ITEM 2
)
[2] => stdClass Object
(
[id] => 6
[name] => ITEM 3
)
[3] => stdClass Object
(
[id] => 7
[name] => ITEM 4
)
)
What I'm trying to do is:
Viewing: ITEM 1 Previous Button: ITEM 4 Next Button: ITEM 2
Viewing: ITEM 2 Previous Button: ITEM 1 Next Button: ITEM 3
Viewing: ITEM 3 Previous Button: ITEM 2 Next Button: ITEM 4
etc
I guess I'm really trying to turn my original array into another array of prev/next based on which item I am viewing.. if that makes sense..? Any help would be greatly appreciated!