About Ajax Page Search
Progressively enhances the search form on a website.
|Category 1||Development Tools|
Modules that have more to do with assisting development of a site rather than managing its content.
|Category 2||Markup Generation|
Markup modules that are called upon to generate or parse markup (like HTML). Markup modules are most often used on the front-end of a site (rather than admin).
|Category 3||Other Modules|
Modules that have a unique purpose not covered by existing categories.
Should be safe for use in production environments. *
|Compatibility||2.1, 2.2, 2.3, 2.4|
|Date Added||July 24, 2012|
|Last Updated||October 28, 2014|
This module's files should be placed in /site/modules/AjaxSearch/
How to install or uninstall modules
This module progressively enhances the search form to an ajax live search. It will perform a search like you would use the form normally, and returns the output of the search page. So the search will still work without js enabled.There's some basic styling attached to this module in the "styling-example". You can use it to get started. See readme in there.
Added in 1.1.2
- added support to turn off automatic script injection. See Module Setting section for further information.
Added in 1.1.0
- added key support for browsing results with arrow down and up.
- added escape key to close results.
- added close results on click outside
So it works almost out of the box with the basic install profile of ProcessWire, you only need make a minor change to the search.php template file to only return the content part (results) on a ajax request.
To get the ajax search only return the content, open search.php and change the output on the bottom to this:
if(!$config->ajax) include("./head.inc"); echo $out; if(!$config->ajax) include("./foot.inc");
It comes with some module options to define various settings regarding the search form.
as_minLength = 3 // min length for starting ajax requestas_close_text = 'close' // close button text as_search_form = #search_form // if you have a different search form id,class as_search_input = #search_query // if you have a different search input id,class as_query_name = 'q' // this is the default param name as_query_url = '' // if left blank the script will take the action of the form add_script = true // automatic script injection before closing body. You can turn this off and add the script manually
add_script: If you turn this off, you'll need to output the config vars used by AjaxSearch.js before the script include like:
<?php echo "<script>var as_config =" . json_encode($modules->AjaxSearch->data) . "<script>"?>
- Download the contents of this repository and put the folder into your site/modules/ folder
- Login to processwire and got to Modules page and click "Check for new modules". You should see a note that AjaxSearch module wes found. Install the module.
No comments yet. Be the first to post!
Your e-mail is kept confidential and not included with your comment. Website is optional.
- Admin Helpers
- Core Modules
- Development Tools
- Field Types
- File Validator
- Input Fields
- Language Modules
- Language Packs
- Markup Generation
- Premium Modules
- Process Modules
- Proof of Concept
- Site Profiles
- Social, Feeds, Services
- Text Formatters
- Other Modules
- Users and Access
*Use modules at your own risk. There are no guarantees or warranties. It is recommended that you backup your site and database before installing new modules.