Example #1
0
 /**
  * @param string $route
  * @return string
  * @throws \yii\web\NotFoundHttpException
  */
 public function actionRoute($route = 'index')
 {
     /* @var $dp Page */
     $page = Page::parse($route);
     $dp = Page::find()->where('name = :name AND active = :active AND language = :language', [':name' => $page, ':active' => Page::ACTIVE_YES, ':language' => Language::getCurrent()])->one();
     if ($dp === null) {
         throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'));
     }
     $this->registerLayout($dp->layout);
     return $this->render($dp->template, ['dp' => $dp]);
 }