![]() |
Hi,
Below is my routing but I can't get the last uri segment in to the function. PHP Code: $routes->get('/admin/reports/stores/:num', 'Admin/Reports/Brands::stores/$1',['filter'=>'accessfilter']); here is the function PHP Code: public function stores($id = false){ not sure what I'm doing wrong here ![]()
11-18-2021, 01:27 AM
(This post was last modified: 11-18-2021, 01:28 AM by captain-sensible. Edit Reason: characters without [code] giving me an emjoi )
I'd should not be false as default since you are expecting an id in this controller.
Thanks guys for the response.
this '/admin/reports/stores/(:num)' did not work ![]() this the path to the controller "Admin/Reports/", the controller is "Brands" and the function is "stores" hence PHP Code: "Admin/Reports/Brands::stores/$1" this works "/admin/reports/stores/:num' but the value ":num" can not be picked up by the function "stores" I'm on CI-4.14
i would like you to try domain.something/admin/reports/stores/6 for web browser address bar at top url but make the route
Code: $routes->get('admin/reports/stores/:num', 'Brands::stores/$1'); and take out default value in method for now i've taken out the forward slash in front of admin as well
Yes the default routing works
![]() Any idea how to manage custom routing and have the auto routing off? PHP Code: $routes->setAutoRoute(false);
$routes->setAutoRoute(false); looks like you just did it !
section on mine is: Code: /** this is a sample of my routes in Routes.php Code: $routes->get('setUp','Setup::setUpForm'); play around and yo uwill be fine ; make sure you have version control , i.e git i like "tags" to go back to incase their is a problem
with the auto route off we can't pass these variable on the URI unless the URI class is used. So, any idea how can we have a custom routs with data been passed as my code below (which is not working)
PHP Code: $routes->get('/admin/reports/stores/:num', 'Admin/Reports/Brands::stores/$1');
11-18-2021, 03:51 AM
(This post was last modified: 11-24-2021, 02:23 AM by InsiteFX. Edit Reason: forward slashes should be back slashes on namesapce )
Try this your missing the () on :num.
PHP Code: $routes->get('/admin/reports/stores/:num', 'Admin/Reports/Brands::stores/$1'); Let me know if that works for you. EDITED: according to @iRedds What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |