Using where on load records
7 posts by 3 authors in: Forums > CMS Builder
Last Post: March 17, 2015 (RSS)
By Mikey - March 16, 2015
I'm trying to display information on a page - only if the record has information in the 'content' wysiwyg editor of the record created for it, any record that does not contain information in the 'content' filed within the CMS will not be displayed. I need to apply this on the ( // load records from clients ).
Anyone have any suggestions on how to get this working?
// search results per page
if (@$_REQUEST['searchResultsPerPage'] AND is_numeric(@$_REQUEST['searchResultsPerPage'])){
$perPage = $_REQUEST['searchResultsPerPage'];
}
else{
$perPage = '4';
}
// load records from 'clients'
list($clientsRecords, $clientsMetaData) = getRecords(array(
'tableName' => 'clients',
'where' => 'content',
'perPage' => @$perPage ? $perPage : '4',
'loadUploads' => true,
'allowSearch' => true,
'orderBy' => 'date DESC',
));
With what I have presently - nothing displays.
By gkornbluth - March 16, 2015 - edited: March 16, 2015
Try this Zick,
'where' =>'content != ""',
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By Dave - March 17, 2015
Jerry's right on, there.
I'll just add that when you have quotes inside of quotes it's sometimes hard to read them. I use ample spaces for that to make my life easier:
'where' => ' content != "" ', // or...
'where' => " content != '' ",
Cheers!
interactivetools.com
By Mikey - March 17, 2015
Thanks Jerry & Dave for the tips. I'll apply this and keep trucking. Really appreciate the help.
By Mikey - March 17, 2015
Again - thanks for the help.
Do you think the OR solution below will work without any issues, for displaying records if a "client testimonial OR content exist" within the client's record.
'where' => " (customer_testimonial != '' OR content != '') ",