Moving to next and previous whilst in detail view (not in list view)
3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 18, 2008 (RSS)
By zaba - November 18, 2008
Hi,
I am trying to create next and previous links on a news detail page which would in theory load the same page with the next or previous record. The page would initially have been loaded from a link in the news listing page. I have set up the pages to my design etc but I am stuck on how i could do this from a detail page.
Any help would be greatly appreciated.
code from the listing page
And this is the detail page
I am trying to create next and previous links on a news detail page which would in theory load the same page with the next or previous record. The page would initially have been loaded from a link in the news listing page. I have set up the pages to my design etc but I am stuck on how i could do this from a detail page.
Any help would be greatly appreciated.
code from the listing page
<?php
require_once "/removed on purpose/public_html/cmsAdmin/lib/viewer_functions.php";
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '10',
));
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="559" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="newspagehead">SCS Group news centre</td>
</tr>
<?php foreach ($newsRecords as $record): ?>
<tr>
<td valign="top" class="newshead"><img class="newsarrowpad" src="/gfx/newsarrow.gif" alt="" width="16" height="12" /><?php echo $record['title'] ?></td>
</tr>
<tr>
<td valign="top" class="newssnippet"><p class="_5"> <?php foreach ($record['image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img class="newsthumbpad" align="left" src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $record['title'] ?>" />
<?php elseif ($upload['isImage']): ?>
<img class="newsthumbpad" align="left" src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo $record['title'] ?>" />
<?php endif ?>
<?php endforeach ?>
<?php echo $record['summary'] ?></p>
<p class="_0">[ <a class="qlmenu" target="content" href="<?php echo $record['_link'] ?>">Read More</a> ] <span class="released">Date released <?php echo date('d.m.Y', strtotime($record['date'])); ?></span></p>
</td>
</tr>
<tr>
<td valign="top" class="newsrule"><img src="/gfx/dot509.gif" alt="" width="509" height="1" /></td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>
And this is the detail page
<?php
require_once "/removed on purpose/public_html/cmsAdmin/lib/viewer_functions.php";
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$newsRecord = @$newsRecords[0]; // get first record
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="559" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="newspagehead">SCS Group news centre</td>
</tr>
<tr>
<td valign="top" class="newshead"><img class="newsarrowpad" src="/gfx/newsarrow.gif" alt="" width="16" height="12" /><?php echo $newsRecord['title'] ?></td>
</tr>
<tr>
<td valign="top" class="newssnippet">
<?php foreach ($newsRecord['image'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<img class="newsthumbpad" align="left" src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo $newsRecord['title'] ?>" />
<?php endif ?>
<?php endforeach ?>
<?php echo $newsRecord['content'] ?>
</td>
</tr>
<tr>
<td valign="top" class="newssnippet">
<p class="_0">[ <a class="qlmenu" href="<?php echo $newsMetaData['_listPage']; ?>" target="content">Back</a> ] < <a class="qlmenu" href="#" target="content">Previous</a> | <a class="qlmenu" href="#" target="content">Next</a> > [ <a class="qlmenu" href="#" target="_blank">Print</a> ] <span class="released">Date released <?php echo date("d.m.Y", strtotime($newsRecord['date'])) ?></span></p></td>
</tr>
</table>
</body>
</html>
Re: [zaba] Moving to next and previous whilst in detail view (not in list view)
By Dave - November 18, 2008
Hi Zaba,
Have a look at this post:
http://www.interactivetools.com/iforum/P66131#66131
Have a look at this post:
http://www.interactivetools.com/iforum/P66131#66131
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] Moving to next and previous whilst in detail view (not in list view)
By zaba - November 18, 2008
Perfect, thanks!