3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 14, 2014   (RSS)

By jh - August 13, 2014 - edited: August 14, 2014


This is our search code.

<form method="POST" action="searchResults.php">
<input name="title,intro_keyword" type="text" value="" size="16">
<input type="submit" name="submit" value="Search">

It will display all related keywords on the searchResults.php page.

I have no idea how the search results sorting .

What is the sorting rule?

Is it possible to change?

Thanks a lot!


Hi Jac,

I guess you're using the getRecords function to retrieve your results? If so you can add an orderBy variable to it's array to decide what order the results are displayed in:

  // load records from 'blog'
  list($blogRecords, $blogMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'loadUploads' => true,
    'allowSearch' => true,
    'orderBy'     => "title, content DESC"

The orderBy variable should contain a MySQL ORDER BY string. You can read about it here: 


By default the function will order the results by what you have set in the sections settings. (See attached screen shot).



Greg Thomas
PHP Programmer - interactivetools.com

Hi Greg

Always get nice help from you.

It is a really useful information.

Thank you!