Question

I got a little problem here. I'm currently trying to use the Zend Router Rewrite but I got this error:

Fatal error: Uncaught exception 'Zend_Controller_Router_Exception' with message 'alias is not specified'

Here's my code for the route:

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

The URL i'm trying to access is: /blog/categories/general/.

Why am I getting this error?

P.S.: I didn't specify a default value for :alias 'cause I have this route also:

// BLOG -> CATEGORIES
$route = new Zend_Controller_Router_Route(
    'blog/categories/',
    array(
        'module'     => 'blog',
        'controller' => 'categories',
        'action'     => 'index'
    )
);
$router->addRoute('blog-categories', $route);
Was it helpful?

Solution

This error is probably coming from somewhere where you are trying to output a link using the route, such as the URL helper:

$this->url(array(), 'blog-categories-list')

It's telling you that you need to pass 'alias' to this as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top