How To Create Root Pages?

I’ve read the related topic in Yii 1.x discussions (Default Controller for root), but unfortunately the author havn’t found any solution. So I ask again.

How can I create pages: feedback.php, about.php etc in a view folder of custom controller/site controller and then access them by going to site.com/feedback, site.com/about etc without adding actions and rules for each one?

Add the last rule like:




'<page>' => 'site/page',



You’ll lose ability not to specify routes for each controller action though.

If I understand correctly the sentence above means:

Тебе не придется указывать роуты для последующих экшенов контроллера. Или слово though в конце предложения говорит о каком-то подводном камне?

Did I understand correctly?

Sorry for the russian injections, but my english isn’t allow me to talk on the level at which you speak.

By the way. The code below use Yii 1 to specify action for rendering static pages under views/site/page folder:




'page'=>array(

                'class'=>'CViewAction',

                'defaultView'=>'about',

                'basePath'=>'pages',

            ),

        );



How can I implement the same in Yii 2?

Придётся прописывать роуты вообще для всего потому как такое правило отключает все умолчания.

Page rendering is easy:




public function actionPage($view = 'index')

{

  try {

    return $this->render('site/page/' . $view);

  } catch (InvalidParamException $e) {

    throw new HttpException(404);

  }

}



hm…not bad! Thank you! I think this moment must be documented somewhere to prevent newbie difficulties…