dev-master
9999999-devSearch pages accross a SilverStripe site.
BSD-2
The Requires
search silverstripe
Search pages accross a SilverStripe site.
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)
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)
Search pages accross a SilverStripe site.
BSD-2
search silverstripe