Display Multi List titles but not current one

3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 20, 2010   (RSS)

Re: [jonoc73] Display Multi List titles but not current one

By Chris - August 20, 2010 - edited: August 20, 2010

Hi Jono,

If you're not using $onews_pagesRecords for anything other than the sidebar, it would be easy enough to add a WHERE filter to not return the main detail page record. To do this, you'll need to move your code around a little so that your "Record not found" check runs before you try to use $news_pagesRecord['num'] for the WHERE. New code in red:

list($news_pagesRecords, $news_pagesMetaData) = getRecords(array(
'tableName' => 'news_pages',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));

$news_pagesRecord = @$news_pagesRecords[0];
if (!$news_pagesRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

list($onews_pagesRecords, $onews_pagesMetaData) = getRecords(array(
'tableName' => 'news_pages',
'where' => mysql_escapef('num <> ?', $news_pagesRecord['num']),
));


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

Re: [chris] Display Multi List titles but not current one

Chris -

Excellent! Another useful set-up.

You're cooking on gas today!

:0)

Perch