Customized routing |
Hi,
in CI3 i used a MY_Router class and a customized _parse_routes function. If i find a product url in the products table i used my own (overwritten) _parse_routes and then i used _set_request to specify the controller i want to use. Otherwise i used the CI3 _parse_route function for all other routes. What is the way for doing that in CI4? The resaon: I have product pages, but my url has no specific word like "products" in order to write this route in the routes file. (:any) is not working, because all other routes will be affected.
Hi,
i don't use locales or translations. My URL is something like domain.com/product-name-2 or domain.com/other-product Do i missing anything?
It is an example to use your own Router.
I don't know if it is useful, but i found a solution.
I extended the RouterCollection class and within this class i created with the $this->get(), $this->post() method my custom routes from the database (url's are stored in a database table) @kenjis what i don't know: Are this routes called first or at the end after my other routes in the Routes.php?
I don't know your customization, but the current Routing behavior is:
https://codeigniter4.github.io/CodeIgnit...e-priority
(08-19-2022, 04:14 PM)kenjis Wrote: I don't know your customization, but the current Routing behavior is: I did this: PHP Code: class RouteCollection extends BaseRouteCollection Will this route be called before the routes in Routes.php? |
Welcome Guest, Not a member yet? Register Sign In |