CodeIgniter Forums
Use :any wildcard two times -CI route Help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Use :any wildcard two times -CI route Help (/showthread.php?tid=64458)



Use :any wildcard two times -CI route Help - NeoCodeIgniter - 02-22-2016

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


RE: Use :any wildcard two times -CI route Help - InsiteFX - 02-22-2016

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.


RE: Use :any wildcard two times -CI route Help - NeoCodeIgniter - 02-22-2016

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

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