public function search(array $data, BlogSearchForm $form, SS_HTTPRequest $request) { $link = $this->getBlog()->Link(); //if we have keyword and category if (isset($data['Category']) && isset($data['Keyword']) && $data['Category'] && $data['Keyword']) { $link = $this->getBlog()->Link("?keyword={$data['Keyword']}&category={$data['Category']}"); } elseif (isset($data['Category']) && $data['Category']) { $link = BlogCategory::get_by_id('BlogCategory', $data['Category'])->getLink(); } elseif (isset($data['Keyword']) && $data['Keyword']) { $link = $this->getBlog()->Link("?keyword={$data['Keyword']}"); } return Controller::curr()->redirect($link); }