'_root_' => 'welcome/index', // The default route '_404_' => 'welcome/index', //'welcome/404', // The main 404 route
public function action_index() { $segments = explode('/', Uri::detect(), 3); // Just break it in to 3 segments for now //Note $page[0] is empty so ignore it $data['page'] = isset($segments[1]) ? $segments[1] : '/'; $data['parameters'] = isset($segments[2]) ? $segments[2] : null; // Search the database for the page // My db query code here // Ignore this testing variable. It would normaly be set in relation to the responce from the db query $results = true; // Do we have any results from the db query if($results) { // Build view with wigets etc... } else { Response::redirect(Uri::create("welcome/404", 'refresh')); } // Display the page $this->response->body = View::factory('welcome/index', $data); }
// Code Here for checking modules, controllers & folders if($route['__catchall__'] != null) { list($match->directory, $match->controller, $match->method) = call_user_func($route['__catchall__']; return $match; } // Code Here for returning false to the request so that it routes to a 404
public function action_index() { $segments = Uri::segments(); //Note $page[0] is empty so ignore it $data['page'] = isset($segments[1]) ? $segments[1] : '/'; $data['parameters'] = array_slice($segments, 1); // Search the database for the page // My db query code here // Ignore this testing variable. It would normaly be set in relation to the responce from the db query $results = true; // Do we have any results from the db query if($results) { // Build view with wigets etc... } else { Response::redirect('welcome/404', 'refresh'); } // Display the page $this->response->body = View::factory('welcome/index', $data); }
'(.*)' => 'welcome/index'
'_catchall_' => 'catchallcontroller/index'
'_root_' => 'welcome/index', // '_catchall_' => 'catchallcontroller/index', '_404_' => 'welcome/404',
It looks like you're new here. If you want to get involved, click one of these buttons!