I have a site called: orders.
In the controllers folder I have a sub folder called: manage.
In there I have a controller called: editOrder
In the editOrder controller I have an index function that get an $id as a parameter.
In one of my forms I have a link to: editOrder/1
In my route file I have this code: $route['editOrder'] = 'manage/editOrder';
The link gives the error page not found.
I tried to go to the page manually, like this: http://localhost/orders/editOrder/1
Page not found
I tried this way:
In my route file:
$route['editOrder/(:num)'] = "manage/editOrder/$1";
Page not found
I have changed my config file to:
$config['uri_protocol'] = 'PATH_INFO';
$config['enable_query_strings'] = TRUE;
And tried this way:
http://localhost/orders/?c=editOrder&m=index&id=1
That takes me to the home page.
How can I pass the id segment to the editOrder controller?????
Ahhhhhhhhhh
How would I call this controller????
Make sure:
Your custom route comes after the 2 default ones. So it should be:
Your controller file
editOrder.php
has aclass editOrder extends CI_Controller
and is inside the folder"controllers/manage/"
;Your editOrder controller has a
function index($id) {}
method;To sum up, if you're going to call a method, you need to specify it. In case of routing, that means you have to specify even the index() method.