[eluser]wiredesignz[/eluser]
Generally the second segment of the URL determines which controller method is called, but, if you use _remap you can intercept the call and it becomes another level of routing with more intelligent usage.
If however you create a base controller class using _remap it gives your application much more potential like so.
Code:
class BaseController extends ACL_Controller
{
public $user;
function __construct()
{
parent::__construct();
$this->load->plugin(array('twig','form','widget'));
//$this->output->enable_profiler();
}
function _remap($method)
{
$data =& $this->load->_ci_cached_vars;
$data['page'] = strtolower(get_class($this));
$data['method'] = $method;
if (method_exists($this, $method))
{
if ( ! $this->acl_error)
{
call_user_func_array(array($this, $method), array_slice($this->uri->segments, 2));
}
}
else
{
show_404();
}
if (request_is_ajax()) return;
$view = new mxView();
$data['widget'] = new mxWidget();
$this->output->final_output = $view->load('layout.tpl', $data, TRUE);
}
}