How do I add search feature to CMS builder pages?
6 posts by 2 authors in: Forums > CMS Builder
Last Post: August 5, 2011 (RSS)
By jeffrenner - August 4, 2011 - edited: August 4, 2011
Re: [jeffrenner] How do I add search feature to CMS builder pages?
By Jason - August 4, 2011
Most of the work in setting up a search page with CMS builder is setting up your HTML form.
For example, if you wanted to search against title, level, and lookandsay all from 1 text field, your form could look something like this:
<form method = "post" action = "searchResults.php">
Search : <input type = "text" name = "title,level,lookandsay_keyword" value = "" /><br/>
<input type = "submit" name = "search" value = "Search" />
</form>
Here we assume we have a PHP page that will display the results called searchResults.php. We use the _keyword special name at the end of our field name to tell CMS builder that we want to find the entered text anywhere in the fields, it doesn't need to be an exact match (for other options , see the DOCS page here: http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html )
Then, all we need to do is set up our query on searchResults.php. As long as title, level, and lookandsay are actual field names in the section we want to search on, the search query is built automatically. All we need is the getRecords call. Let's assume we are searching against a section called "articles":
list ($articleRecords, $articleMetaData) = getRecords(array(
'tableName' => 'articles',
));
We would put this on searchResults.php
Hope this helps get you started.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] How do I add search feature to CMS builder pages?
By jeffrenner - August 4, 2011
The section editor is set up with the fields I just need to have a sort feature at the top of the page.
Here is the url of the page I am trying to sort: http://clowninroundbooks.com/pages/BrowseBooks.php
Thanks.
JR
Re: [jeffrenner] How do I add search feature to CMS builder pages?
By Jason - August 4, 2011
I took a look at your page, and I see that clicking on title, level, or lookandsay level does re-sort the list. Can you explain how you would like this page to work differently?
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] How do I add search feature to CMS builder pages?
By jeffrenner - August 4, 2011
JR
Re: [jeffrenner] How do I add search feature to CMS builder pages?
By Jason - August 5, 2011
Glad to hear everything is working now. Let us know if you run into any other problems.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/