Re: [MercerDesign] Archived news stories
Hi,
What's happening is that getPrevAndNextRecords() function doesn't allow for a where clause, so it's returning the next/previous record relative to the entire list, not in the archive section you want.
What you'll need to do is to create a news detail page specifically for viewing archive records. You can then use a loop to figure out which records come before and after the selected record like this:
NOTE: This code has not been tested against actual records.
list($news_pre_prepRecord, $news_pre_prepMetaData) = getRecords(array(
'tableName' => 'news_pre_prep',
'where' => " news_pre_prep_archive = 'summer10' "
));
$prevRecord = array();
$nextRecord = array();
$recordNumber = getNumberFromEndOfUrl();
for($index = 0; $index < $news_pre_prepMetaData['totalRecords']; $index++ ) {
if($news_pre_prepRecord[$index]['num'] == $recordNumber ) {
if($index != 0){
$prevRecord = $news_pre_prepRecord[$index - 1];
}
if($index != ($news_pre_prepMetaData['totalRecords'] -1 )) {
$nextRecord = $news_pre_prepRecords[$index + 1];
}
}
}
Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/