CodeIgniter URI routing (dynamic, multilingual)
- by koteko
I'm trying to redirect all routs to one main controller. Here is my routes.php
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";
//$route['(\w{2})/(.*)'] = '$2';
//$route['(\w{2})'] = $route['default_controller'];
$route['(en|ge)/(:any)'] = $route['default_controller']."/index/$1";
$route['(:any)'] = $route['default_controller']."/index/$1";
I need language id to be passed with every link (like: http://site.com/en/hello-world)
Here is my main controller:
class Main extends Controller
{
function __construct()
{
parent::Controller();
}
function index($page_type=false, $param=false)
{
die($page_type.' | '.$param.'| Aaa!');
}
}
I want to check if predefined file type exists (like: http://site.com/en/archive/05-06-2010 - here predefined type would be archive) then do something. If not then search in the database for slug. If not found then go to 404.
The problem is that I can't get index function parameters ($page_type, $param). Thanks for help.