Searching 2 tables based on keyword, but also pull in image on search results

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 18, 2015   (RSS)

By Daryl - November 17, 2015 - edited: November 17, 2015

Hi zaba,

It's not recommended to update the lib functions as the changes will get overwritten when we upgrade the CMS.
To get the thumbnail images, you can use getUploads() function:

getUploads($tableName, $fieldName, $recordNum);

For example:

foreach ($searchRows as $record){
  if     ($record['tablename'] == 'products')     { $uploadFieldName = 'image_gallery'; }
  elseif ($record['tablename'] == 'case_studies') { $uploadFieldName = 'images'; }
 
  if     (@$uploadFieldName){
    $uploadRecords = getUploads($record['tablename'], $uploadFieldName, $record['num']);
  }
  $uploadRecord  = @$uploadRecords[0]; // get the first record
}

Let me know if you have any question.

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com

By zaba - November 18, 2015

Thanks Daryl,

thats perfect. :-)