Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Search

 

 


ink63
New User

Dec 13, 2011, 8:33 AM

Post #1 of 2 (224 views)
Shortcut
Search Can't Post

Hello, I am new to the CMS family and was wondering if it is possible to set up a keyword search and have options such as All words, Any words or exact phrase.

Example: keyword search box

Then user can choose radio buttons or a checkbox to select what type of search they want from above.

Thanks!

Anne


Jason
Staff / Moderator


Dec 13, 2011, 11:12 AM

Post #2 of 2 (221 views)
Shortcut
Re: [ink63] Search [In reply to] Can't Post

Hi Anne,

Welcome to the forum!

There are a couple of ways you can set this up. Using the radio button/check box method would probably require you to create your MySQL WHERE clause manually.

The other option is to have CMS Builder do that search for you automatically. We do this by adding options to the field name of the search field.

For example, if you had a field in your section called "title" and you wanted to do an exact search (ie, the title must match exactly what is typed in), your search field just has to have the name title

example:


Code
  <input type = "text" name = "title" />


If you wanted to do a keyword search (ie, what is typed in needs to appear somewhere in the title), you can add the suffix _keyword to your name:

example:


Code
<input type = "text" name = "title_keyword" />


There are a number of different options you can use. You can find a list of valid options here:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

If you're comfortable with MySQL at all and you want to see exactly what is being executed on your search, you can use the 'debugSql' option in your getRecords() call.

example:


Code
    list($newsRecords, $newsMetaData) = getRecords(array( 
'tableName' => 'news',
'debugSql' => true,
));


This option will print out the MySQL query being executed to the screen.

Hope this helps get you started. Please let us know if you have any other questions, or run into any problems
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/