Prev/Next links on a Detail page?

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 8, 2010   (RSS)

By zip222 - March 7, 2010

Is there a way to include links to the previous and next records on a Detail page?

Re: [zip222] Prev/Next links on a Detail page?

By zip222 - March 7, 2010

Found the answer, but...

Found the answer here
http://www.interactivetools.com/iforum/P66131#66131

But now I need the links for the first and last records. It seems like it should be possible, but I keep getting undefined variables.

Re: [zip222] Prev/Next links on a Detail page?

By zip222 - March 7, 2010

Got it. Here it is in case someone else is looking for this...

Place this in your header. change the table name to your table name:

list($prevRecord, $nextRecord, $firstRecord, $lastRecord) = getPrevAndNextRecords(array(
'tableName' => 'portfolio',
'recordNum' => getNumberFromEndOfUrl(),
));


And here are the relevant variables:

Previous Record: <?php echo $prevRecord['_link'] ?>
Next Record: <?php if($nextRecord): ?>
First Record: <?php echo $firstRecord['_link'] ?>
Last Record: <?php echo $lastRecord['_link'] ?>