problem in routes.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: problem in routes.php (/showthread.php?tid=71925) |
problem in routes.php - DELE - 10-12-2018 Code: $route['tv'] = 'Controller_tv'; if I access http://localhost/tv and http://localhost/tv/[category]/[pagination] its return true. but if I access http://localhost/tv/[id_tv] its return 404 Page Not Found. I know $route['tv/(:any)/(:num)'] and $route['tv/(:num)'] is collision. how i can fix it but not changings ( tv ). thanks before RE: problem in routes.php - Sky - 10-12-2018 Hi! Put $route['tv/(:num)'] route after $route['tv'] and before $route['tv/(:any)/(:num)'] RE: problem in routes.php - InsiteFX - 10-12-2018 Routes that have (:any) in them have to be the last route in the routes file because it is a wild card route. RE: problem in routes.php - dave friend - 10-12-2018 Your life would be much easier if you would name your controllers to be what you want them to be in a URL. Instead of Controller_TV.php just call it TV.php. That would eliminate the awkward and otherwise unnecessary $route['tv'] = 'Controller_tv'; It's in the controllers directory so it's pretty hard to confuse it with some other kind of class. It does make sense to name models and views for easy recognition. You can probably guess what Events_m.php and events_v.php are, and how they are likely related to the controller Events.php Just a friendly suggestion. |