Hi,
I am hoping someone might be able to point out where I am going wrong with some routing.
I have the following controller:
class Authors_Controller extends Page_Controller {
private static $allowed_actions = array('authors');
private static $url_handlers = array(
'bookshop/authors//$Action' => 'authors'
);
public function authors(){
if($this->request->param('Action') > 0){
$output = '[output a specfic author based on the value of Action]';
} else {
$output = '[output other content about authors]';
}
return $output;
}
}
and in the template
<div class="row">$authors</div>
if the url in the browser is /bookshop/authors I get the second output fine ('[output other content about authors]'), but when I add any number to the url i.e. /bookshop/authors/45 I get a 404 Page Not Found
I have tried putting the routing rule in the config.yml as opposed to using $url_handlers and that makes no difference to the result.
Any pointers on what I am doing wrong?