I'm creating a portfolio-website. On the homepage, I want to show a single "featured" project, with a short description and a link to the full project.
When a user arrives at the homepage I want to show the first "featuerd" project, but there should also be a previous and next link, so that the user can cycle through all featured projects.
I'm having two problems:
- prev() and next() resets the pointer in the array to another key than the current one. How can I prevent this?
- To be able to cycle through the projects, when the current project shown is the first in line, the previous-link should point to the last project in the array. Same holds true when the current project is the last one. I just can't get this to work.
I don't think it's a pagination problem I'm looking at here, since I don't want to number anything. Or am I completely off?