Welcome Guest, Not a member yet? Register   Sign In
hwo to set URI router Case-insensitive ?
#1

[eluser]RING[/eluser]
i set router in /app.../config/routes.php

Code:
$route['member(.*)'] = "member$1";
$route['(.*)'] = "home/$1";

the URL :
http://domain.com/member -->> class: Member , method:index()
http://domain.com/someword -->> class: Home , methodConfusedomeword()

but the URL like this :
http://domain.com/Member -->> class: Home , method:member()
http://domain.com/mEmber -->> class: Home , method:member()
in fact i want to access the class "Member",


hwo to set URI router Case-insensitive ?


another question:
how can i use some route setting, and i do NOT want it go into effect in any else CLASS ?
#2

[eluser]xwero[/eluser]
Code:
$route[sql_regcase('member').'(.*)'] = "member$1";
$route['[mM][eE][mM][bB][eE][rR](.*)'] = "member$1"; // this is what sql_regcase does
#3

[eluser]TheFuzzy0ne[/eluser]
Try something like this:
Code:
$route['/member(.*)/i'] = "member$1";
#4

[eluser]xwero[/eluser]
[quote author="TheFuzzy0ne" date="1236699785"]Try something like this:
Code:
$route['/member(.*)/i'] = "member$1";
[/quote]
That wouldn't work because the router uses this code to check the routes
Code:
if (preg_match('#^'.$key.'$#', $uri))
The line is found in the _parse_routes method
#5

[eluser]TheFuzzy0ne[/eluser]
The only other (more hacky way) I can think of, would be to do this:
Code:
$route['[Mm][Ee][Mm][Bb][Ee][Rr](.*)'] = "member$1";

Hope this helps.
#6

[eluser]xwero[/eluser]
TheFuzzy0ne look at response #1 Smile
#7

[eluser]TheFuzzy0ne[/eluser]
lol, thanks. I kinda missed that... I never heard of sql_regcase until today, so thanks for pointing that out.
#8

[eluser]RING[/eluser]
[quote author="xwero" date="1236699645"]
Code:
$route[sql_regcase('member').'(.*)'] = "member$1";
$route['[mM][eE][mM][bB][eE][rR](.*)'] = "member$1"; // this is what sql_regcase does
[/quote]

GOOD answers
#9

[eluser]RING[/eluser]
and.....
how can i use some route setting, and i do NOT want it go into effect in any else CLASS ?
#10

[eluser]TheFuzzy0ne[/eluser]
Please refine your question.




Theme © iAndrew 2016 - Forum software by © MyBB