404 issue with existing function |
[eluser]jsuissa[/eluser]
I'm getting 404 errors for an existing function with routes setup. I've included the relevant routes and URL excerpts below. The function 'details' exists in the 'items' controller. Any insights as to why this may be happening would be greatly appreciated. Route (first works, second fails): $route['item'] = 'items'; $route['item/(:any)'] = 'items/details'; URL fails for details function: http://www.example.com/index.php/item/in...gramming/1 URL works for index function: http://www.example.com/index.php/item/
[eluser]Noobigniter[/eluser]
Assuming "1" is the id of the item. Maybe like this, but given my level ... I'm not sure. Code: $route[‘item/(:any)/(:num)’] = ‘items/details/$2’; Regards.
[eluser]jsuissa[/eluser]
Thanks -- tried changing the route to: $route[‘item/(:any)/(:num)’] = ‘items/details/$2’; and also tried switching order: $route['item/(:any)'] = 'items/details'; $route['item'] = 'items'; Still keep getting 404 error. I put a die() in the details function just to eliminate something inside the function as the problem and it never runs so it's not even getting to the function. Below is the beginning of the controller if that helps: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
[eluser]pickupman[/eluser]
I think CroNiX meant like: Code: $route['item/(:any)/(:num)'] = 'items/details/$2';
[eluser]CroNiX[/eluser]
Try passing the id to the function. Code: $route['item/(:any)'] = 'items/details/$1'; Which can also be accessed (if you do this) as a parameter to your details() method. Code: public function details($id = FALSE) |
Welcome Guest, Not a member yet? Register Sign In |