Welcome Guest, Not a member yet? Register   Sign In
Use :any wildcard two times -CI route Help
#1
Sad 

Hello..

I have building multi language support website..I need to hide controller name..(because it will hard to convert controller name when language change )

My Route Code

$route['(\w{2})/(:any)'] = 'page/view/$1';
$route['(\w{2})/(:any)/(:any)'] = 'page/view/$1/$2';
$route['(\w{2})/(:any)/(:any)/(:any)'] = 'page/view/$1/$2';

$route['(\w{2})/(:any)'] = 'catalogue/view/$1';
$route['(\w{2})/(:any)/(:any)'] = 'catalogue/view/$1/$2';
$route['(\w{2})/(:any)/(:any)/(:any)'] = 'catalogue/view/$1/$2';
$route['(\w{2})/(:any)/(:any)/(:any)/(:any)'] = 'catalogue/view/$1/$2/$3';

$route['(\w{2})/(.*)'] = '$2';
$route['(\w{2})'] = $route['default_controller'];

Problem :- Only one controller method work..actually catalogue controller method work.Page controller get catalogue values Confused Sad

Reason:- You can't use two :any method in same route php file Huh

Anyway to solve this problem?

Idea:- Telling page controller to avoid taking catalogue controller values Blush or any other method

I hope i explain my problem..please guys help me Big Grin
Reply
#2

You can not use (:any) that way, it is a catch all route and needs to be the last route called.

See the Users Guide on Routes.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Yes i understand :any need to be add after all routes Sad

Do u know any way to translate page,catalogue controller names ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB