Show Record if Active

3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 29, 2009   (RSS)

Re: [aquaman] Show Record if Active

By Chris - December 29, 2009

Hi aquaman,

Presumably you are using this on a detail page? If you want to restrict things so that your page will only display records which are active, you can add to the where clause like this:

list($aboutRecords, $aboutMetaData) = getRecords(array(
'tableName' => 'about',
'where' => whereRecordNumberInUrl(1) . ' AND active ="1"',
'limit' => '1',
));


With this setup, a visitor who tries to view the detail page of a record which is not active will likely get a "Record not found!" message or an error, depending on the rest of your code. If you want something else to happen instead, please let me know and I'll show you how to add some logic for that.

I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Show Record if Active

By theclicklab - December 29, 2009

Hi Chris, that worked great, thanks so much!