views:

28

answers:

1

Hi,

I've a new question :) I'll briefly explain what I'm trying to achieve. Right now I have an url that looks like this.

/products/index/brand:figleaves

I want this to look like this

/brand/figleaves

By writing the following route rule I get what I want.

Router::connect('/brand/:brand/*', array('controller' => 'products', 'action' => 'index'));

Everything goes fine, but then I discovered the pagination logic has been destructed. If I click on 'next page' I get redirected to the url /products/index/page:2.

  1. it doesn't pass the brand parameter
  2. it redirects back to the products_controller and not to the url I defined in the route rule.

In fact I'd need this as url /brand/figleaves/page:2.

Strange thing is if I browse to /products/index/brand:figleaves and click on Next, then I get redirected to /brand/figleaves/page:2. How can this be explained?

I'd appreciate some help with this :)

Kind Regards, Laurent

A: 

For those interested in how I solved this.

I just defined some options in the paginator in my view and passed the value explicitly, like this.

    $this->Paginator->options(array
            ('url'=> array(
                'controller' => 'products', 
                'action' => 'index',
                'brand'=>$this->params['brand']
   )));  

That does the job :)

Laurent