Is there a way to make all methods in a controller stem from the route, so instead of me manually having
Code:
$route['newdebate'] = 'main/newdebate';
$route['questions'] = 'main/questions';
Instead every controller method in the Main controller is set from the root so it automatically becomes /newdebate or /questions upon me creating the controller method?
Also I'm having a problem with routing and my controller.
Code:
I have this code in my controller.
public function debate($id){
$debate = $this->db->query("SELECT * FROM debates WHERE nodeviewid = '$id' && nodeview = 'debate'")->result_array();
print_r($debate); exit();
}
When I point the browser to /main/debate/1 the $debate variable isn't blank, but when I go to /debate/1 the $debate variable is blank.
My route says
Code:
$route['debate/:num'] = 'main/debate/:num';