Welcome Guest, Not a member yet? Register   Sign In
Using Default Routes with an ID as the first segment.
#1

[eluser]tonybianco[/eluser]
Hi there. I'm new to CI but not so much to MVC. I have done some stuff with Rails and a few other frameworks. However, I'm running into a wall trying to figure out the routing of urls.

I'm wanting to set up a default route so that when someone types up mydomain.com/45678 <--(as in an affiliate id) then it will route to the proper controller and action with the numbers as the the id of the affiliate.

I spent time digging around the documentation but I couldn't find a way to do that for me. I was thinking that if I did this that it would work:
Code:
$rout['(:num)'] = "affiliates/affiliate_lookup/$1";

But it doesn't work nor does it even feel right when I'm coding that. Any suggestions would be very helpful?
#2

[eluser]bastones[/eluser]
Not sure if that's a typo - see $rout in your code - should be $route. That should work, remember segment URLs are done by class/function/ID order. I've never URI routed before so you're gonna have to refer here.
#3

[eluser]tonybianco[/eluser]
LOL! OMG!! It was a typo. It worked just fine actually.




Theme © iAndrew 2016 - Forum software by © MyBB