Routing with parametars problem |
Hi,
I asked this on stackoverflow but decided that this is better place to ask for help, so my problem is this: When I need to take parameter from URI I just can't make my route works. So this is what I have in route.php Code: $routes->add('admin', 'Admin/Login::index'); Code: $routes->add('admin/cam/edit/(:any)', 'Admin/AdminGlavni::cam_edit_show/$1'); Quote:404 - File Not Foundand cam_edit_show in AdminGlavni Class is defined like this: Code: public function cam_edit_show($id) { In meant time I got suggestion to disable autoRoute but that didn't help at all. (04-08-2022, 07:35 AM)iRedds Wrote: Slash in handler namespace is an error.Hi and tnx for reply, but could you tell me exactly what is problem with slash? It should not be there at all or it should be other kind of slash (backslash?) Sorry if this is stupid question, but I compare my route with CI 4 official tutorial / example and everything looks the same just changed names of URI and controler... I mean this looks the same as my route, and this is from https://codeigniter.com/user_guide/incom...uting.html Code: $routes->add('product/(:any)', 'Catalog::productLookup/$1');
The namespace uses a backslash.
$routes->add('product/(:any)', 'Namespace\Catalog::productLookup/$1'); https://codeigniter.com/user_guide/incom...aceholders (04-08-2022, 08:39 AM)iRedds Wrote: The namespace uses a backslash. O M G, I am official retarded for missing this Tnx a lot for pointing out this stupid mistake. Now it is working yeee But what is not now clear to me is why my other routes works with wrong slash? If you look my example form first post you will see that I have all wrong slashes but only one with parameter really throw error, and that is why I didn't notice it before. But still why other routes works? (04-08-2022, 08:44 AM)Didytz Wrote: But what is not now clear to me is why my other routes works with wrong slash? |
Welcome Guest, Not a member yet? Register Sign In |