Help with orderBy for events list

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 5, 2017   (RSS)

By Dave - July 5, 2017

Hi zip222, 

Is this for a viewer search page?  What about something like this?

// set orderBy
if (@$_REQUEST['status'] == 'past') { $orderBy = " `date` DESC "; }
else                                { $orderBy = " `date` ASC "; } // upcoming events

// load records from 'events'
list($eventsRecords, $eventsMetaData) = getRecords(array(
  'tableName'   => 'events',
  'loadUploads' => true,
  'allowSearch' => false,
  'orderBy'     => $orderBy,
));

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com