Search
2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 13, 2011 (RSS)
By ink63 - December 13, 2011
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
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
Re: [ink63] Search
By Jason - December 13, 2011
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:
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:
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:
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
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:
<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:
<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:
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 - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/