An open API service indexing awesome lists of open source software.

https://github.com/brandcom/silverstripe-elemental-site-search

Basic site search for the SilverStripe Elemental module
https://github.com/brandcom/silverstripe-elemental-site-search

search silverstripe silverstripe-module

Last synced: about 1 year ago
JSON representation

Basic site search for the SilverStripe Elemental module

Awesome Lists containing this project

README

          

# SilverStripe Elemental Site Search Module
Basic site search for the SilverStripe Elemental module. It works by saving a text reprentation of the elemental area to an extra field in SiteTree.

## Requires

* [SilverStripe](https://www.silverstripe.org/)
* [SilverStripe Elemental](https://github.com/dnadesign/silverstripe-elemental)

## Usage

### Install this module with composer

composer require jbennecker/silverstripe-elemental-site-search

Make sure you don't have `FulltextSearchable` enabled in `_config.php`.

### Add the search form

To add the search form, add `$SearchForm` anywhere in your template.

For example in Header.ss

...


$SearchForm

...

### Override the template

Lastly you can override the template for the result page.

app/templates/Layout/Page_results.ss


$Title

<% if $Query %>

You searched for "{$Query}"


<% end_if %>

<% if $Results %>


<% else %>

Sorry, your search query did not return any results.


<% end_if %>

<% if $Results.MoreThanOnePage %>


<% if $Results.NotLastPage %>

<% end_if %>
<% if $Results.NotFirstPage %>

<% end_if %>

<% loop $Results.Pages %>
<% if $CurrentBool %>
$PageNum
<% else %>
$PageNum
<% end_if %>
<% end_loop %>

Page $Results.CurrentPage of $Results.TotalPages



<% end_if %>

### Clear caches

Then finally add ?flush=1 to the URL and you should see the new template.