views:

16

answers:

1

how do i set up routing as follows

these work with the standard routing

/posts            => index action (listing)
/posts/view       => view action (individual post)
/posts/add        => add action
/posts/edit       => edit action

what abt these?

/posts can by filtered based on 1 or more query strings, in any order. eg.

/posts/tagged/tag1 /posts/tagged/tag1/timeframe/1w => fyi. 1w means 1 week /posts/timeframe/1w/tagged/tag1 => can be in any order /posts/sortby/dtposted => more options maybe added

how can i handle these? i tried

$route = new Zend_Controller_Router_Route(
    'posts/*',
    array(
        'controller' => 'posts',
        'action' => 'index'
    )
);
$router->addRoute('postsIndex', $route);

but of cos, all routes to posts/* goes to the index controller. not what i want

A: 

You dont need to use a route for those url's if your using proper naming conventions it should naturally.

class PostsController extends Zend_Controller_Action{
    public function viewAction(){
    }
    public function editAction(){
    }
    public function addAction(){
    }
    public function indexAction(){
    }
}

I suggest going back to basics and learning how controllers models and views work in the zend framework before trying to understand routing :)

adrian