Skip to main content
Added note.
Source Link
Frederick Marcoux
  • 2.2k
  • 1
  • 30
  • 58

I'm currently creating a new version of my website using Zend Framework and I'm stuck with a little problem I've seen in the past.

There are my routes: (a part)

// BLOG -> CATEGORIES $route = new Zend_Controller_Router_Route( 'blog/categories', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'index' ) ); $router->addRoute('blog-categories', $route); // BLOG -> CATEGORIES -> LIST ARTICLES (:alias = name of the category) $route = new Zend_Controller_Router_Route( 'blog/categories/:alias', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'list', 'alias' => null ) ); $router->addRoute('blog-categories-list', $route); 

The problem is that: when I go to /blog/categories/, it brings me the list action. What I don't want. I need the index.

Is there a way to fix that without using, for exemple, /blog/categories/view/:alias ?

Note: I have the same problem for /blog/ (list all articles) and /blog/:alias/ (display single article).

I'm currently creating a new version of my website using Zend Framework and I'm stuck with a little problem I've seen in the past.

There are my routes: (a part)

// BLOG -> CATEGORIES $route = new Zend_Controller_Router_Route( 'blog/categories', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'index' ) ); $router->addRoute('blog-categories', $route); // BLOG -> CATEGORIES -> LIST ARTICLES (:alias = name of the category) $route = new Zend_Controller_Router_Route( 'blog/categories/:alias', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'list', 'alias' => null ) ); $router->addRoute('blog-categories-list', $route); 

The problem is that: when I go to /blog/categories/, it brings me the list action. What I don't want. I need the index.

Is there a way to fix that without using, for exemple, /blog/categories/view/:alias ?

I'm currently creating a new version of my website using Zend Framework and I'm stuck with a little problem I've seen in the past.

There are my routes: (a part)

// BLOG -> CATEGORIES $route = new Zend_Controller_Router_Route( 'blog/categories', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'index' ) ); $router->addRoute('blog-categories', $route); // BLOG -> CATEGORIES -> LIST ARTICLES (:alias = name of the category) $route = new Zend_Controller_Router_Route( 'blog/categories/:alias', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'list', 'alias' => null ) ); $router->addRoute('blog-categories-list', $route); 

The problem is that: when I go to /blog/categories/, it brings me the list action. What I don't want. I need the index.

Is there a way to fix that without using, for exemple, /blog/categories/view/:alias ?

Note: I have the same problem for /blog/ (list all articles) and /blog/:alias/ (display single article).

Source Link
Frederick Marcoux
  • 2.2k
  • 1
  • 30
  • 58

Zend Router - URL with or without parameters are two differents routes

I'm currently creating a new version of my website using Zend Framework and I'm stuck with a little problem I've seen in the past.

There are my routes: (a part)

// BLOG -> CATEGORIES $route = new Zend_Controller_Router_Route( 'blog/categories', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'index' ) ); $router->addRoute('blog-categories', $route); // BLOG -> CATEGORIES -> LIST ARTICLES (:alias = name of the category) $route = new Zend_Controller_Router_Route( 'blog/categories/:alias', array( 'module' => 'blog', 'controller' => 'categories', 'action' => 'list', 'alias' => null ) ); $router->addRoute('blog-categories-list', $route); 

The problem is that: when I go to /blog/categories/, it brings me the list action. What I don't want. I need the index.

Is there a way to fix that without using, for exemple, /blog/categories/view/:alias ?