public function actionIndex() { //$page = Pages::find()->where(['id' => $_GET['p']])->one(); $page = Pages::find()->where(['id' => $_GET['p']])->one(); //$content = $this->getBlocks($page); //$content = $this->getBlocks($page); //$con = $this->render('index', ['content' => $content, 'page' => $page]); Template::get_header($page); $this->getBlocks($page); Template::get_footer(); }
public function actionIndex() { $options = Options::find()->where(['key' => 'mainpage'])->one(); $pageId = $options->value; $page = Pages::find()->where(['id' => $pageId])->one(); //$content = $this->getBlocks($page); //$con = $this->render('index', ['content' => $content, 'page' => $page]); Template::get_header($page); $this->getBlocks($page); Template::get_footer(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Pages::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'author_id' => $this->author_id, 'status' => $this->status, 'created' => $this->created, 'updated' => $this->updated]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'snippet', $this->snippet])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'meta_title', $this->meta_title])->andFilterWhere(['like', 'meta_description', $this->meta_description])->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Pages::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $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, 'count_product' => $this->count_product, 'blokc_id' => $this->blokc_id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'images', $this->images])->andFilterWhere(['like', 'hint', $this->hint])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'h1', $this->h1])->andFilterWhere(['like', 'keywords', $this->keywords]); return $dataProvider; }
public static function get_css($file) { $headFoot = Tpl::find()->all(); $blocs = Block::find()->all(); $pages = \backend\modules\pages\models\Pages::find()->all(); $style = ""; foreach ($pages as $p) { $style .= $p->style . "\n"; } foreach ($headFoot as $hf) { $style .= $hf->style . "\n"; } foreach ($blocs as $b) { $style .= $b->style . "\n"; } //$file = preg_replace("/{css}/", "<style>\n" . $style . "</style>", $file); file_put_contents('css/style.css', $style); return $file; }
/** * Finds the Pages model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Pages the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Pages::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }