2017 © Pedro Peláez
 

silverstripe-module silverstripe-pagesearch

Search pages accross a SilverStripe site.

image

burnbright/silverstripe-pagesearch

Search pages accross a SilverStripe site.

  • Sunday, February 21, 2016
  • by jedateach
  • Repository
  • 2 Watchers
  • 9 Stars
  • 337 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

SilverStripe Page Search

A simple search replacement for the default SilverStripe search functionality., (*1)

Searches will be performed on all Text,HTMLText,Varchar, and HTMLVarchar fields for the selected pagetype., (*2)

Pagetype can be specifically set with url vairalble, eg: ?pagetype=BlogEntry., (*3)

Limitations

  • Currently only tested with MySQLDatabase.
  • Does not search on relations. Use a better engine like SOLR for this.

Usage

In your Page_Controller class:, (*4)


public function SearchForm() { $searchText = ($this->request && $this->request->requestVar('Search')) ? $this->request->requestVar('Search') : 'Search'; $form = new Form( $this, 'SearchForm', new FieldList( TextField::create('Search', false) ->setAttribute("Placeholder", $searchText) ), new FieldList( FormAction::create('results', 'Go') ) ); $form->setFormMethod('GET'); $form->setTemplate('SearchForm'); return $form; } function results($data, $form, $request) { $search = PageSearch::create($request); $data = array( 'Content' => '', 'Results' => $search->results(), 'Query' => $search->getQuery(), 'Title' => _t('SearchForm.SearchResults', 'Search Results') ); return $this->owner->customise($data)->renderWith(array('Page_results', 'Page')); }

Because a DataList is returned, you can wrap it in a PaginatedList to add pagination., (*5)

The Versions

21/02 2016

dev-master

9999999-dev

Search pages accross a SilverStripe site.

  Sources   Download

BSD-2

The Requires

 

search silverstripe