Using getPrevAndNextRecords() with both hidden and non-hidden records

7 posts by 4 authors in: Forums > CMS Builder
Last Post: January 13, 2014   (RSS)

By zip222 - January 6, 2014

I am trying to get the getPrevAndNextRecords() function to work with both hidden and non-hidden records. I am doing this on a "preview" site so my client can review postings prior to taking them live. How can I modify this code to make this work?

list($prevRecord, $nextRecord, $firstRecord, $lastRecord) = getPrevAndNextRecords(array(
'tableName' => 'projects',
'recordNum' => getNumberFromEndOfUrl(),
'where' => "hidden=0",
));

Hi Zip222

Try this, it should work:

'where' => " hidden = '0' || hidden = '1' ",

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By mizrahi - January 6, 2014

Unfortunately this doesn't work. This function seems to completely ignore the hidden records. 

What happens with

'where' => "  hidden = '1' ",

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Damon - January 13, 2014

Hi,

Try this code:

'ignoreHidden'      => true,  // don't hide records with hidden flag set

Let me know if this does what you need.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Damon - January 13, 2014

What version of CMS Builder do you have installed?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/