Hi Community,
I am working with a search function on my SS-powered Web site and am looking for a little guidance. I would like to paginate my search results. Currently, I have the following contents in m Page.php file with contents that I compiled mostly using the helpful documentation.
function SearchForm(){
$searchText = isset($this->Query) ? $this->Query : 'Search';
$searchField = new TextField('Search', '', $searchText);
$searchField->addExtraClass('searchbox');
$searchField->setTitle('searchbox');
$fields = new FieldSet($searchField);
$actions = new FieldSet(
new FormAction('results', 'Go', null, null, 'searchbut', true)
);
return new SearchForm($this, 'SearchForm', $fields, $actions);
}
function results($data, $form){
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);
return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}
I have discovered a page in the documentation called "searchcontext," which mentions pagination, but it does not provide an example that extends the code above. Instead, the pagination information reflects a different way of searching. Do I need to learn how to search using the searchcontext, or can I extend the code above somehow? I have tried a few various modifications to both the SS file and the PHP file to no avail.
Thanks in advance for any insight or help,
Jona