Welcome Guest, Not a member yet? Register   Sign In
Need some help/advise on routing (rewriting my url structure)
#1

[eluser]Unknown[/eluser]
Hello,

I have my url's like this:

Code:
http://localhost/brand/honda/type/cbr600/year/2006/area/frame/group/frame/condition/used

So my url parameters are in key/value pairs.

I'm a bit puzzled on how to route a url like this to:

Code:
http://localhost/honda/cbr600/2006/frame/frame/used

So basically I would like to filter out the keys from my url.

Thanks and regards,
Olaf
#2

[eluser]CrossMotion[/eluser]
Hi O-Love,

if the structure is always the same, you can just filter them out in the route table like this:

Code:
$route['/brand/(:any)/type/(:any)/year/(:any)/area/(:any)/group/(:any)/condition/(:any)'] = '$1/$2/$2/$4/$5';

If the variables change a lot, I would just send everything to one controller where you can sort everything out.
#3

[eluser]Unknown[/eluser]
Hi CrossMotion,

Thx for this tip, it directed me in the right direction...

Regards,
Olaf




Theme © iAndrew 2016 - Forum software by © MyBB