Display Results of Two filters on the Same List Page

14 posts by 3 authors in: Forums > CMS Builder
Last Post: February 10, 2011   (RSS)

Re: [northernpenguin] Display Results of Two filters on the Same List Page

By Jason - February 9, 2011

Hi,

What you need to do is when you're selecting your lists of records, check to see if a record has already been selected. If not, get the first record in your list:

<?php
list($recent_news_articlesRecords, $recent_news_articlesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'where' => 'datediff(publishDate, curdate()) > -365',
'orderBy' => 'publishDate DESC',
));

if(!$recent_news_articlesRecord) {
$recent_news_articlesRecord = $recent_news_articlesRecord[0]; //get first record if specific record wasn't selected
}

?>


<?php
list($newsArchivesRecords, $newsArchivesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'where' => 'datediff(publishDate, curdate()) < -365',
'orderBy' => 'publishDate DESC',
));

if(!$newsArchivesRecord) {
$newsArchivesRecord = $newsArchivesRecords[0]; //get first record if specific record wasn't selected
}


?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason: worked great! Thank you. I did find one minor typo (in blue below).

IT does it again!!

Ragi

Hi,

What you need to do is when you're selecting your lists of records, check to see if a record has already been selected. If not, get the first record in your list:

<?php
list($recent_news_articlesRecords, $recent_news_articlesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'where' => 'datediff(publishDate, curdate()) > -365',
'orderBy' => 'publishDate DESC',
));

if(!$recent_news_articlesRecord) {
$recent_news_articlesRecord = $recent_news_articlesRecords[0]; //get first record if specific record wasn't selected
}

?>


<?php
list($newsArchivesRecords, $newsArchivesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'where' => 'datediff(publishDate, curdate()) < -365',
'orderBy' => 'publishDate DESC',
));

if(!$newsArchivesRecord) {
$newsArchivesRecord = $newsArchivesRecords[0]; //get first record if specific record wasn't selected
}


?>


Hope this helps

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Display Results of Two filters on the Same List Page

By ross - February 10, 2011

Hi Ragi

Thanks for the heads up on that :). Other than that, glad it all worked out for you.

Keep us up to date with how you are making out.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/