Patxi1980
Patxi1980

Reputation: 1763

How to use optional parameters in Yii URL Manager?

I have a problem with Yii urlManager.

I have a page that is a list of videos, so I add the following rule:

'videos'=>'video/index'

Now I want to add the page:

'videos_pag<Video_page:\d+>'=>'video/index'

Is there a way in order to put the two rules together?

I tried this:

'videos(_pag<Video_page:\d+>)?'=>'video/index',

but it does not work properly.

Upvotes: 1

Views: 2566

Answers (1)

briiC
briiC

Reputation: 2134

Use two lines, if first fails, second will work (if everything correct) :)

'videos_pag<Video_page:\d+>'=>'video/index',
'videos'=>'video/index',

Upvotes: 4

Related Questions