PREVIOUS AND NEXT RECORD SEARCH ON DETAILS PAGE - Aug 3rd, 2010


Matrix created an image viewer that displays thumbnail images for a gallery of images as the list viewer page. Each
thumbnail is linked to the detail page where the larger image is displayed. The new idea was to add Next & Previous
links on each Detail Page for sequential navigation through the individual image pages if someone doesn't want to return
to the section list (thumbnail display) each time.

Interactive Tools’ Dave Edis came to the rescue once again.
(This works in version 1.18 and above.)

He said: Add this code to the bottom of step 1 in your detail viewer (change the ‘Table name’ to the name of your
table):



list($prevRecord, $nextRecord) = getPrevAndNextRecords(array(
'Table name' => 'news',
'recordNum' => getNumberFromEndOfUrl(),
));



Then add this where you want your prev/next links to go:



<?PHP if (@$prevRecord): ?>
<a href="<?PHP echo $prevRecord['_link'] ?>"> &lt;&lt; <?PHP echo $prevRecord['title'] ?></a>
<?PHP endif; ?>

<?PHP if (@$nextRecord): ?>
<a href="<?PHP echo $nextRecord['_link'] ?>"><?PHP echo $nextRecord['title'] ?> &gt;&gt;</a>
<?PHP endif; ?>



Voila...

After implementing this, Matrix commented:

“It works like a charm for us. This client is very actively using 10 "albums" contained in a "gallery" all produced
through CMS Builder. How we did this was to simply present the thumbnails in a list page, each linked to a detail page
with the image and lots of content. With the addition of the next and previous links for each detail page, it's perfect.

So, the interface only requires uploading a new work for each new page, add details and content in a couple of
additional text box fields, and publish. It's especially helpful that the detail pages can be re-ordered by dragging.
Very nice features.”



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service