views:

26

answers:

1

I have a site with next structure. We have car's brands. If we click on link with brand, list with models of this model should be open. The url like this: http://example/brand/4.

All good. But i don't know, how find a brand id. I need this, because i should know, where the models must be open (under what brand). I am using Router.

Can you help me, how can i find this id. Or can you help me with regular expression. For example: if in url we has found a combination "brand/", we get a next number.

thanks.

+1  A: 

So given the URL http://example/brand/4, where 4 is the brand ID, you want to be able to access this? If so then you will be able to get this in your controller using _getParam(), using whichever name you setup in the route.

Let's say your route was setup like this:

$route = new Zend_Controller_Router_Route(
    'brand/:brandID',
    array(
        'controller' => 'brands',
        'action'     => 'view'
    )
);

then in your controller you'd do:

$this->_getParam('brandID');
Tim Fountain
Thanks. Yesterday i have solved this problem as you.
Alexander.Plutov
So now you can select this as the correct answer.
Keyne