0 follower

Customizing Error Display

Our blog application is using the templates provided by Yii to display various errors. Because the style and wording are different from what we want, we would like to customize these templates. To do so, we create a set of view files under the directory /wwwroot/blog/protected/views/system.

We first create a file named error.php. This is the default view that will be used to display all kinds of errors if a more specific error view file is not available. Because this view file is used when an error occurs, it should not contain very complex PHP logic that may cause further errors. Note also that error view files do not use layout. Therefore, each view file should have complete page display.

We also create a file named error403.php to display 403 (unauthenticated) HTTP errors, and a file named error404.php to display 404 (page not found) HTTP errors.

To learn more details about the naming of these error view files, please refer to the Guide.