uri_to_assoc(n) doesn't work after routing-Collection of common programming errors

So this currently loads the page for me.

/controllername/view/id/27/title/shoes

However, I want the user to be able to type in:

/controllername/27/shoes

to view the file. So in the routing file, I made a rule like this,

$route[‘controllername/(:num)/(:any)’] = “controllername/view/id/$1/title/$2”;

The original address works with uri_to_assoc(n) because I have it as

    $array = $this->uri->uri_to_assoc(3);
    $id = $array['id'];
    $title = $array['title'];

But once I route it and use the new address to access the file, I get the errors: Message: Undefined index: id Message: Undefined index: title

I do not get these errors with my original url way of accessing it. I guess the value of uri_to_assoc(3) changes once the url is changed but I thought the routing function would take care of that. Can anyone help me get rid of these variable errors?

Originally posted 2013-11-09 19:47:38.