Example #1
0
 public function parseRequest($manager, $request)
 {
     $pathInfo = $request->getPathInfo();
     $pathInfo = chop($pathInfo, $manager->suffix);
     if (preg_match('%^([\\-\\w]+)?$%', $pathInfo, $matches) && $pathInfo != '') {
         $model = Page::findOne(['slug' => $matches[1]]);
         if ($model !== null) {
             $_GET['id'] = $model->id;
             return ["fluent/page/view", []];
         }
         return false;
     }
     return false;
 }
Example #2
0
 public function actionView($id)
 {
     $page = Page::findOne($id)->getTranslation(Language::getCurrentLangID(), false);
     return $this->render('view', ['page' => $page]);
 }
Example #3
0
 /**
  * Finds the Page model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Page the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Page::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }