Hi, I am developing a new section consisting of 2 pages, a current news page which shows the top 5 results list based on sort order in admin (and also the detail of that record when clicked). This I have done without any problems. The second part is a similar page called news archive. Here I want to show the list of records starting from the 6th record onwards, and also have a paging function.
I have created the archive page and paging function, but I can't work out how to tell it to ignore the first five results (as that is taken care of in the news page).
heres the code for the news-archive.php page.
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/........../viewer_functions.php";
list($newsRecords_detail, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => @$_REQUEST['detail'] ? "num = ".(int)$_REQUEST['detail'] : '1',
'limit' => '1',
));
$newsRecord = @$newsRecords_detail[0]; // get first record
// show error message if no matching record is found
if (!$newsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
list($newsListRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'perPage' => '5',
'allowSearch' => '0',
));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="left_col">
<!--This is the detail content -->
<h3><?php echo $newsRecord['title'] ?></h3>
<p><?php echo $newsRecord['lead_paragraph'] ?></p>
<?php foreach ($newsRecord['image'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo $newsRecord['title'] ?>" title="<?php echo $newsRecord['title'] ?>" />
<?php endif ?>
<?php endforeach ?>
<?php echo $newsRecord['content'] ?>
</div><!--/left_col -->
<!--This is the list content -->
<div id="right_col">
<h1>News</h1>
<?php foreach ($newsListRecords as $record): ?>
<h2><a href="?page=<?php echo $newsMetaData['page'] ?>&detail=<?php echo $record['num'] ?>"><?php echo $record['title'] ?></a></h2>
<?php foreach ($record['image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $record['title'] ?>" title="<?php echo $record['title'] ?>" /><?php endif ?>
<?php endforeach ?>
<p><?php echo $record['summary'] ?></p>
<?php endforeach ?>
<!--Paging -->
<?php if ($newsMetaData['prevPage']): ?><<
<a href="<?php echo $newsMetaData['prevPageLink'] ?>">prev</a>
<?php else: ?>
<< prev
<?php endif ?>
- page <?php echo $newsMetaData['page'] ?> of <?php echo $newsMetaData['totalPages'] ?> -
<?php if ($newsMetaData['nextPage']): ?>
<a href="<?php echo $newsMetaData['nextPageLink'] ?>">next</a> >>
<?php else: ?>
next >>
<?php endif ?>
<!--/Paging -->
</div><!--/right_col -->
<div class="clear"></div><!--/clear -->
</body>
</html>