
MY_Controller_remap.php
By:
svizion on
Apr 28th, 2012 | syntax:
PHP | size: 1.68 KB | hits: 27 | expires: Never
<?php
/* --------------------------------------------------------------
* VIEW RENDERING
* ------------------------------------------------------------ */
/**
* Override CodeIgniter's despatch mechanism and route the request
* through to the appropriate action. Support custom 404 methods and
* autoload the view into the layout.
*/
public function _remap($method)
{
/* --------------------------------------------------------------
* Check for Existing Functions inside this Controller
* ------------------------------------------------------------ */
if (method_exists($this, $method))
{
call_user_func_array(array($this, $method), array_slice($this->uri->rsegments, 2));
}
else
{
/* --------------------------------------------------------------
* Look for "_404" named methods.
* ------------------------------------------------------------ */
if (method_exists($this, '_404'))
{
call_user_func_array(array($this, '_404'), array($method));
}
else
{
show_404(strtolower(get_class($this)).'/'.$method);
}
}
/* --------------------------------------------------------------
* VIEW RENDERING
* ------------------------------------------------------------ */
// Add logic here for the index page.
// Bonfire Template Stuff
Template::set_view('index');
Template::render();
}
?>
// End of _remap Method.
// End of CodeIgniter - Bonfire _remap method.