Welcome Guest, Not a member yet? Register   Sign In
problem in routes.php
#1

Code:
$route['tv']               = 'Controller_tv';
$route['tv/(:any)/(:num)'] = 'Controller_tv/$1/$2';    // tv/[category = popular,toprated, etc]/[pagination]
$route['tv/(:num)']        = 'Controller_tv/view/$1';  // tv/[id_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
Reply
#2

Hi!
Put $route['tv/(:num)'] route after $route['tv'] and before $route['tv/(:any)/(:num)']
Reply
#3

Routes that have (:any) in them have to be the last route in the routes file
because it is a wild card route.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB