public function actionView($alias) { $model = Page::find()->where(['alias' => $alias])->one(); if (!$model) { throw new NotFoundHttpException(\Yii::t('common', 'Page not found')); } return $this->render('view', ['model' => $model]); }
public function actionView($alias) { $former = new ContactFormV3(); $model = Page::find()->where(['alias' => $alias])->one(); if (!$model) { //throw new NotFoundHttpException(\Yii::t('frontend', 'Page not found')); throw new NotFoundHttpException('Page not found'); } return $this->render('viewreg', ['model' => $model, 'former' => $former]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Page::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'alias', $this->alias]); $query->andFilterWhere(['>=', 'created_at', $this->created_at ? strtotime($this->created_at . ' 00:00:00') : null])->andFilterWhere(['<=', 'created_at', $this->created_at ? strtotime($this->created_at . ' 23:59:59') : null]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Page::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'page_title', $this->page_title])->andFilterWhere(['like', 'page_content', $this->page_content])->andFilterWhere(['like', 'meta_title', $this->meta_title])->andFilterWhere(['like', 'meta_description', $this->meta_description])->andFilterWhere(['like', 'alias', $this->alias]); return $dataProvider; }
</div> <?php } ?> </div> </div> </div> </div> </div> </div> <?php // out page why $page_why = \backend\modules\page\models\Page::find()->where(['alias' => 'why'])->one(); ?> <?php if ($page_why) { ?> <div class="section profit middle-padding"> <div class="container"> <?php echo Html::decode($page_why->page_content); ?> </div> </div> <?php } ?>
.wrap {height:760px !important;} .navbar {height:46px;} } @media (max-width: 1024px) { .ab-0 {left:-100px;} } </style> <?php if ($page_about = \backend\modules\page\models\Page::find()->where(['alias' => 'about'])->one()) { ?> <div class="row"> <div class="col-md-5 col-sm-5 col-xs-5"> <div class="ab ab-0 substrate"> <h1>О компании -<br/>«СК Мегаполис»</h1> <div class="overflow mCustomScrollbar" data-mcs-theme="dark-thin" style="height:235px;"> <?php echo Html::decode($page_about->page_content); ?> </div> </div> </div>