[eluser]Bart v B[/eluser]
Hello there.
I am playing with mij routes.
I want to have a _remap function.
So when i have a method the it must be written to domain.tld/foo
What i did:
1. created a class called page:
Code:
<?php
class Page extends Controller
{
function __construct()
{
parent::Controller();
}
function _remap($method)
{
if($method === $this->uri->segment(2))
{
$this->method();
}
else
{
$this->index();
}
}
function index()
{
$data['content'] = 'index called!';
$this->load->view('base_view', $data);
}
function method()
{
$data['content'] = 'Method called!';
$this->load->view('base_view', $data);
}
}
2. the second thing what i did in my routes.php is:
Code:
$route['default_controller'] = "page";
$route['scaffolding_trigger'] = "";
$route['([a-z])'] = "page/$1";
So, when i go to test.tld/index.php/page
i am getting: index called!
When i go to test.tld/index.php/page/foo
i am getting: method called!
So that is working.
But when i go to:
test.tld/index.php/foo
then i get the errror page not found.
Am i missing something in my routes?