Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

Search form includes error pages


Go to End
Reply


2 Posts   645 Views

Avatar
Puddle

Community Member, 2 Posts

14 March 2013 at 3:21am

Downloaded the latest SS. Great system and highly flexible. I haven't ran in to any problems uptil now: I implemented a search form, but when I start an empty search it includes everything (including error pages, images etc). Now I filtered out the empties using ContentControllerSearchExtension and filtering "if(!emty($data[Query]))" etc etc. That works, although the "return" statement in the "else" fails.

Anyway: can someone please help me? Unchecking 'Show in search' also does not work.

Avatar
Puddle

Community Member, 2 Posts

14 March 2013 at 3:53am

Temporary workaround (nasty I know, but it works)

public function results($data, $form, $request) {
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => _t('SearchForm.SearchResults', 'Search Results')
);
$searchLength = strlen($data[Query]);
if($searchLength > 2){
return $this->owner->customise($data)->renderWith(array('Page_results', 'Page'));
} else {
return $this->owner->customise($data);
}
}