AjaxSearch ver. 1.6
The AjaxSearch snippet is an enhanced version of the original FlexSearchForm snippet for MODx. This snippet adds AJAX functionality on top of the robust content searching. There are two seperate ways to handle the dynamic searching with either live search functionailty or by allowing the user to start the search with the typical form buttom. Both return the results in the current window with some nice effects.
Install Instructions - Snippet
- Copy the contents of the file snippet-ajaxSearch-tpl.php into a new snippet named AjaxSearch
- Copy the AjaxSearch folder and all files into the assets/snippets folder.
- Add the snippet call like the following:
- [!AjaxSearch? &AS_showResults=`0` &AS_landing=`17` &showMoreResults=`1` &moreResultsPage=`17`!]
- Note: If javascript is disabled the snippet functions like the original FlexSearchForm.
- You will want to set any of the other options in the snippet call for these users.
- You can test this with the following: [!AjaxSearch? &ajaxSearch=`0` &otherParamsAsNeeded=`here`!]
- Use the following styles to change how your search looks:
- #ajaxSearch_form
- #ajaxSearch_input
- #ajaxSearch_submit
- #ajaxSearch_output
- .ajaxSearch_paging
- .AS_ajax_result
- .AS_ajax_resultLink
- .AS_ajax_resultDescription
- .AS_ajax_more
- If you are using the display more results link setup a new page with the snippet call to display your results.
- Test and see the search working with AJAX!
Install Instructions - Plugin (Optional)
- Copy the contents of the file Search_Highlight_plugin.php file to a new plugin named SearchHighlighting.
- On the System Events tab select OnWebPagePrerender.
- Somewhere in your template or document add the html:
This will display the terms and a link to remove the highlighting. - Do a search and click the link to see the search highlighting carried through to the page.
Basic Usage
[!AjaxSearch? &AS_showResults=`0` &AS_landing=`17` &showMoreResults=`1` &moreResultsPage=`17`!]