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",
));

By gkornbluth - January 6, 2014

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 gkornbluth - January 6, 2014

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 zip222 - January 13, 2014

Ignorehidden doesnt seem to have any effect. I also tried combinig it with the  where statements above. 

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/