I have a PageTag which shows all the Pages matching a Tag Name passed in the url.
where tags is the pagename
http:://<website>/tags/<slug> it shows the Pages related to the tag
http:://<website>/tags/SearchForm it should redirect to the searchform page
I want to exclude the SearchForm from the slug. Because there is already a action with that name.
class PageTag_Controller extends Page_Controller
{
static $allowed_actions = array(
'index',
'specificTags',
);
public static $url_handlers = array(
'$Slug!' => 'specificTags',
'' => 'index'
);
function index() {
$data = array(
'Results' => array()
);
return $this->->renderWith('PageTag');
}
//UrlHandelres not redirecting Hence using common methods to all
//Controller
function specificTags() {
$Slug = $this->request->param('Slug');
$Tag = Tag::get()->filter('slug',$Slug)->first();
if($Tag) {
if($Slug == 'SearchForm'){
$this->owner->redirect('SearchForm')
}
return $this->renderWith('PageTag');
}
}
How do I exclude the SearchFrom from the Url handlers directing to the function specificTags?
Above code still works but I need to include condition in the specificTags function to check whether slug is SearchFrom otherwise it will not work.
Page_Controller::add_extension('ExtensibleSearchExtension');
class ExtensibleSearchExtension extends Extension {
function SearchForm() {
}
public function results() {
}
}