ifelse
(Iiinkvizitor)
February 21, 2013, 11:04pm
1
I’ve created module, that action show list of models with pagination: example.com/article/default/index?page=X
I want write rule, which it’s looks like: example.com/article/X
My config:
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
...
'article/<page:\d+>' => 'article/default/index',
),
),
Links in paginator genereted rigtht, but if I click in link I have 404 error.
P.S.: sry for my english
redguy
(Maciej Lizewski)
February 22, 2013, 11:32am
2
a nd what is ‘…’ stand for? maybe there is another rule that matches url-s like ‘/article/2’ and because it is earlier on the list - it wins and is used to handle request?
ifelse
(Iiinkvizitor)
February 22, 2013, 12:43pm
3
other rules:
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
redguy
(Maciej Lizewski)
February 22, 2013, 12:57pm
4
'<controller:\w+>/<id:\d+>' => '<controller>/view',
this one matches your requests and causes 404.
try this order:
'article/<page:\d+>' => 'article/default/index',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
ifelse
(Iiinkvizitor)
February 23, 2013, 12:55am
5
Thank you. Problem solved