Custom URLs and paging problem

Hi to all. :)

This is my first Yii app right now, and I have a problem with URLs.

I have URLs like this:

site.com/cat/CatName/38/2

In main.php configuration file:




'cat/<title>/<id:\d+>/'=>'offers/cat/id/<id>/',

'cat/<title>/<id:\d+>/<page:\d+>'=>'offers/cat/id/<id>/Offers_page/<page>',



So in fact I have:

Controller: OffersControler

Method: actionCat

Id and Page id as GET parameters.

Well, this is working great, but when I click on second page (using ‘ajaxUpdate’=>false), the link looks like this:

site.com/offers/cat/title/CatName/id/38/Offers_page/2

The question is - how to set these rules to pagination?

Expected url should be:

site.com/cat/CatName/38/2

I hope ‘my english’ is understandable. :D

Best Regards,

Simo

ps - URLs are from currently working site, and they must be not changed.

But anyway, for future applications, SEO urls are used pretty often and this info will help me.

OK, I’ve read again CUrlManager info, and I see where is the problem.

So, how can I skip some URL vars when constructing such a URL?

Let me explain again what I’m trying to do:

The site have Products and Categories.

When I click to some Category Name (Mobile Computers for example), products from this category are listed bellow.

And the rules looks like this:




'category/<title:\w+>/<id:\d+>/<page:\d+>'=>'products/category/title/<title>/id/<id>/Products_page/<page>',



Expected URL is:

site.com/category/Mobile+Computers/24/3

And it’s working, but pagination gives me this URL for 4-Th page:

site.com/products/category/title/Mobile+Computers/id/24/Products_page/4

I really don’t know how to proceed with this and is there a solution currently.

Best Regards,

Simeon

ps - sorry for the Up…

try these rules:




'cat/<title>/<id:\d+>/'=>'offers/cat',

'cat/<title>/<id:\d+>/<Offers_page:\d+>'=>'offers/cat',



Hey, that’s cool!

Thanks Onman.

I just changed the positions of the rows, otherwise ?Offer_page appears, because first rule matched I tnink…:

‘cat/<title>/<id:\d+>/<Offers_page:\d+>’=>‘offers/cat’,

‘cat/<title>/<id:\d+>/’=>‘offers/cat’,

Thanks again! :)