Hi all
I have a menu for example as below:
<ul>
<li><a href="/services/option1">Option 1</a></li>
<li><a href="/services/option2">Option 2</a></li>
<li><a href="/services/option3">Option 3</a></li>
</ul>
I need to build a separate widget on the page that allows a user to click NEXT or PREVIOUS buttons to navigate through the menu items above instead of clicking the links directly.
So I thought the best thing to do would be to store the URL's into an array and then use that array as a way of finding what the HREF will be on the NEXT and PREVIOUS buttons by using the current URL of the existing page.
I have my array as follows:
$array = array('option1', 'option2', 'option3');
So lets say I am on www.mysite.com/services/option2 - I would know that the next and previous buttons should take me to option3 and option1 respectively.
My question is, what is the best way to populate my hrefs using the above method (i.e. how would I loop through the array and get the previous and next values from ti in order to use as HREFs on my buttons.
Any advice would be greatly appreciated.
Doug