Yii implements the method of displaying static pages, and yii implements static
This article describes how to display static pages in Yii. We will share this with you for your reference. The details are as follows:
Use a CViewAction built in Yii to serve all these pages.
First, set up a controller class such as DocController to overwrite the actions method.
Public function actions () {return array ('page' => array ('class' => 'cviewaction ',),);}
According to the official guide, the above Code declares an External action class CViewAction.
Then, generate the directory protected/views/doc/pages.
Finally, a file named about. php is stored in this directory with the content "about this site". These pages use the default layout file of the application. Therefore, this file only describes the content on this page.
Http://www.yourhost.com/index.php? R = doc/page & view = about
If there are many static pages, you can put them in the subdirectory. Suppose there is a static page in protected/views/doc/pages/help/contact. php:
Http://www.yourhost.com/index.php? R = doc/page & view = help. contact
Of course, you can also customize the CViewAction behavior. For more information about CViewAction, see the API documentation.