S
S
Sergey Pribylskiy2014-03-31 21:54:55
Yii
Sergey Pribylskiy, 2014-03-31 21:54:55

Yii: urlManager - why is the page not opening?

I decided to rewrite all routes to use a friendly URL, but with a double parameter, the page does not open.
The UrlManager has the following:

{
'catalog/<razdel:\w>/<idname:\w+>' => 'catalog/card',
'catalog/card/<idname:\w+>' => 'catalog/card',
'catalog/<idname:\w+>' => 'catalog/razdel',

'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'<controller:\w+>/'=>'<controller>/index',
}

An error occurs when requesting the /catalog/fun/supercard/ page.
error 404 - not found - /catalog/fun/supercard/
The system could not find the requested action "fun".
Tried deleting all lines - doesn't help
Leave one line 'catalog/< razdel:\w >/< idname:\w+ >' => 'catalog/card', same result
Query /catalog/cart/suercard/ - works fine , the page is rendered
Class CatalogController extends FrontendController {

    public function actionCard($idname, $razdel=''){
// тут мои  действия
    }

}

Here is what is written in applocation.log
2014/04/01 00:42:47 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Системе не удалось найти запрашиваемое действие "fun".' in /Users/xxx/sites/framework/web/CController.php:483
Stack trace:
#0 /Users/xxx/sites/framework/web/CController.php(270): CController->missingAction('fun')
#1 /Users/xxx/sites/framework/web/CWebApplication.php(282): CController->run('fun')
#2 /Users/xxx/sites/framework/web/CWebApplication.php(141): CWebApplication->runController('catalog/fun/supe...')
#3 /Users/xxx/sites/framework/base/CApplication.php(180): CWebApplication->processRequest()
#4 /Users/xxx/sites/sitename.x/yii/protected/behaviors/WebApplicationEndBehavior.php(30): CApplication->run()
#5 [internal function]: WebApplicationEndBehavior->runEnd('frontend')
#6 /Users/xxx/sites/framework/base/CComponent.php(261): call_user_func_array(Array, Array)
#7 /Users/xxx/sites/sitename.x/yii/index.php(13): CComponent->__call('runEnd', Array)
#8 /Users/xxx/sites/sitename.x/yii/index.php(13): CWebApplication->runEnd('frontend')
#9 {main}
REQUEST_URI=/catalog/fun/supercard/
HTTP_REFERER=http://yii.sitename.x/catalog/fun/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2014-03-31
@ASP

'catalog/<razdel:\w>/<idname:\w+>'
do you see the difference?
'catalog/<razdel:\w+>/<idname:\w+>'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question