Re: [InHouse] Using MetaData Recordset
Hi,
From the example you describe, you'll need to create your own next and previous link variables yourself.
Take a look at this example:
<?php
$categoriesArray = array('RED', 'BLUE', 'GREEN');
$currentCat = @$_REQUEST['cat'];
$nextLink = "";
$prevLink = "";
foreach ($categoriesArray as $index => $category) {
if ($category == $currentCat) {
if ($index == count($categoriesArray) - 1) {
$nextLink = "?cat=".$categoriesArray[0];
}
else {
$nextLink = "?cat=".$categoriesArray[$index + 1];
}
if ($index == 0) {
$prevLink = "?cat=".$categoriesArray[count($categoriesArray) - 1];
}
else {
$prevLink = "?cat=".$categoriesArray[$index - 1];
}
break;
}
}
?>
This example uses a hardcoded array of category options, but it could just as easily use a dynamic list from the database. This example is also circular, so when you reach the end of the list (Green), the next link will go the the start of the list (red). When you're at the start of the list, the previous link will go to the last option.
At the end of this code (assuming $_REQUEST['cat'] has a value that is in our array of options), you'll have $nextLink and $prevLink that you can output where ever you need.
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/