New plugin.
Plugin for quick display of search results without going to a separate page. By default it works with evoSearch, hence the name.
Installation
You need to install the plugin from Extras, then create a file with settings for the search snippet (see below) and place a call to the client handler in the page template:
<script>
document.addEventListener('DOMContentLoaded', function() {
new AESearch();
})
</script>
For pages that EVO processes, the client handler script and the file with minimal (at all) styles are included automatically. If you output pages using routes, then you need to include the script manually:
<script defer src="assets/plugins/aesearch/aesearch.min.js"></script>
<link rel="stylesheet" href="assets/plugins/aesearch/aesearch.css">
Markup
The form with the search field must be located in a block with the class aesearch (by default), the name of the search field must be search. The results are displayed in the block with the class aesearch-results.
For example:
<div class="aesearch">
<form>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Search" aria-label="Search" aria-describedby="button-addon2" name="search">
<button class="btn btn-outline-secondary" type="button" id="button-addon2">Search</button>
</div>
</form>
</div>
Search snippet settings
The settings are specified in the file core/custom/config/aesearch.php
<?php
return [
'display' => 10,
'tpl' => '@CODE:<div class="result"><a href="[+url+]">[+pagetitle+]</a></div>'
];
Instead of the evoSearch snippet, you can use any other snippet by specifying its name in the snippet parameter:
'snippet' => 'GrinyahaSearch'
The snippet must return ready-made html, which the client handler will insert into the output block.
Client Handler Parameters
wrapperclass
The class name of the block with the search form.
Default is aesearch.
resultsClass
The class name of the search results block.
Default is aesearch-results.
inputName
Name of the field for entering the query.
Default is search.
minSearch
Minimum number of characters in a request.
Default is 3.
url
Server handler URL. Specified in plugin parameters.
Default is /aesearch.
headers
Additional headers for the request. Default:
{
'X-Requested-With': 'XMLHttpRequest'
}