1

I'm having a problem with PyroCMS and CodeIgniter URI Routing.

I have a page (majors_list) has a child page (major) , which it has a child page too called (course).

$route['majors_list/major/(:any)'] = 'pages/view/majors_list/major';
$route['majors_list/major/(:any)/course/(:any)'] = 'pages/view/majors_list/major/course';

The first routing, is to view the major page which contains all the courses.

The second routing, conflicts with the first routing, and it is used to view the course information.

When I comment the first routing, the second routing works, but the first stops, and vice versa.

A real example:

majors_list/major/Dentistry/course/dental_material
4

1 回答 1

0

你需要交换它们。在我看来,任何与第二条匹配的路线也将与第一条匹配,因此它永远不会到达第二条,因此交换它们将解决问题。

或者,您可以使用正则表达式语法进行路由,并在第一个路由的正则表达式末尾放置一个美元符号,以排除在该点之后继续的路由。

于 2013-08-30T19:56:52.580 回答