アプリのメイン構成:
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/default/error',
),
/protected/modules/site/controllers/ には、DefaultController.php にアクション エラーがあります。
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}
しかし、エラーがある場合は、次のように表示されます。
DefaultController cannot find the requested view "error". (/home/web/framework/web/CController.php:897)
0 /home/web/framework/web/CController.php(800): CController->renderPartial('error', Array, true)
1 /home/web/apps/myapp/protected/modules/site/controllers/SiteController.php(67): CController->render('error', Array)
2 /home/web/framework/web/actions/CInlineAction.php(50): SiteController->actionError()
3 /home/web/framework/web/CController.php(309): CInlineAction->runWithParams(Array)
4 /home/web/framework/web/CController.php(287): CController->runAction(Object(CInlineAction))
5 /home/web/framework/web/CController.php(266): CController->runActionWithFilters(Object(CInlineAction), Array)
6 /home/web/framework/web/CWebApplication.php(283): CController->run('error')
7 /home/web/framework/base/CErrorHandler.php(332): CWebApplication->runController('site/site/error')
8 /home/web/framework/base/CErrorHandler.php(205): CErrorHandler->render('error', Array)
9 /home/web/framework/base/CErrorHandler.php(130): CErrorHandler->handleException(Object(CHttpException))
10 /home/web/framework/base/CApplication.php(713): CErrorHandler->handle(Object(CExceptionEvent))
11 [internal function]: CApplication->handleException(Object(CHttpException))
Yii ドキュメント: CErrorHandler は、ビューに対応するビュー ファイルを次の順序で検索します。
1.WebRoot/themes/ThemeName/views/system: これは、現在アクティブなテーマの下のシステム ビュー ディレクトリです。
2.WebRoot/protected/views/system: これは、アプリケーションのデフォルトのシステム ビュー ディレクトリです。
3.yii/framework/views: これは、Yii フレームワークによって提供される標準のシステム ビュー ディレクトリです。
モジュールを使用しているときに Yii が yii/framework/views のビューを見つけられないのはなぜですか?