[eluser]osci[/eluser]
This is my way of remap in this scenario
In remap I check for existence of title - no spaces or dissallowed chars, use url_title(), and if error show 404.
Code:
function __construct()
{
parent::__construct();
$this->load->model('page_model');
}
public function _remap($method, $params = array())
{
switch ($method)
{ //I disallow ie do_ in the start of the title, to have other routes to controller
case 'do_stuff':
case 'do_other':
if (method_exists($this, $method))
{
return call_user_func_array(array($this, $method), $params);
}
break;
case 'index':
return $this->index('home'); //my default page slug
default:
$query = $this->page_model->get_content($method)->row();
if ($query)
{
return $this->index($method);
}
break;
}
show_404();
}
function index($slug)
{
$query = $this->page_model->get_content($slug)->row();
if (!$query) {show_404();}
// rest of code here
}