Hello,
I have a conflict i need to resolve in the most elegant way possible.
Right now i am making a forum it has categories -> forums -> threads -> posts.
There are two controllers one for Index and the other for Threads.
The Index has a index action that shows the categories and forums with links to the forums. The show action has the forum and uses the following scheme for urls.
/forums/:slug/:page
The forums then have threads shown on the show action, these link to the show action of the threads controller and have urls like so
/forums/:forum/:slug/:page
However these conflict with each other because it thinks forums :page is the threads :slug
Any suggestions how to make it obey my will?
// Routes array
$route = new Zend_Controller_Router_Route(
'forums/:slug/:page',
array(
'module' => 'forums',
'controller' => 'index',
'action' => 'show',
'page' => '1'
)
);
// Make routes
$router->addRoute('forums', $route);
$route = new Zend_Controller_Router_Route(
'forums/:forum/:slug/:page',
array(
'module' => 'forums',
'controller' => 'threads',
'action' => 'show',
'page' => '1'
)
);
// Make routes
$router->addRoute('thread', $route);
Solved i needed a
array('slug' => '^[a-z_]+$')
to make sure the slugs were only strings.