public function actionPartnership() { $enterprise_data = Enterprise::About(); Yii::$app->opengraph->title = Seo::Settings()->title; Yii::$app->opengraph->description = Seo::Settings()->description; Yii::$app->opengraph->image = 'http://xn--90agaunhfc3b5f.xn--p1ai/images/regularSprites/logoIQ174.png'; Yii::$app->opengraph->twitter->card = 'summary'; Yii::$app->opengraph->twitter->site = '@Webtest74'; Yii::$app->opengraph->twitter->creator = '@Webtest74'; return $this->render('about', ['enterprise' => $enterprise_data]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Seo::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'keywords', $this->keywords]); return $dataProvider; }
public function actionIndex() { Yii::$app->opengraph->title = Seo::Settings()->title; Yii::$app->opengraph->description = Seo::Settings()->description; Yii::$app->opengraph->image = 'http://xn--90agaunhfc3b5f.xn--p1ai/images/regularSprites/logoIQ174.png'; Yii::$app->opengraph->twitter->card = 'summary'; Yii::$app->opengraph->twitter->site = '@Webtest74'; Yii::$app->opengraph->twitter->creator = '@Webtest74'; $ids = []; foreach (Part::find()->where('file_foto != ""')->all() as $part) { $ids[$part->id] = null; } $parts = Part::find()->where(['in', 'id', array_rand($ids, 12)])->all(); return $this->render('index', ['parts' => $parts]); }
public static function getMeta($arr = null) { if ($arr) { ?> <title><?php echo Html::encode($arr->title); ?> | kotmonstr.com | артефакты прошлого</title> <meta name="description" content="<?php echo Html::encode(StringHelper::truncate(isset($arr->content) ? $arr->content : $arr->title, 200)); ?> "> <meta name="keywords" content="Артефакты прошлого , альтернативная история , ведическая культура , ведическая библиотека"> <?php } else { $module = Yii::$app->controller->module->id; $controller = Yii::$app->controller->id; $action = Yii::$app->controller->action->id; $url = $module . '/' . $controller . '/' . $action; $meta = Seo::getPageMeta($url); //vd($meta); ?> <title><?php echo $meta ? Html::encode($meta->title) : '| kotmonstr.com | артефакты прошлого<'; ?> </title> <meta name="description" content="<?php echo is_object($meta) ? Html::encode($meta->description) : 'kotmonstr.com | артефакты прошлого'; ?> "> <meta name="keywords" content="<?php echo is_object($meta) ? Html::encode($meta->keywords) : 'kotmonstr.com | артефакты прошлого | альтернативная история | ведическая культура русов'; ?> "> <?php } }
protected function InitTags() { //var_dump(Url::to('')); $this->tags = Seo::findOne(['url' => Url::to('')]); }
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" lang="ru-RU"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" lang="ru-RU"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" lang="ru-RU"> <!--<![endif]--> <head> <meta charset="<?php echo Yii::$app->charset; ?> "/> <title><?php echo Seo::Settings()->title; ?> </title> <?php echo Html::csrfMetaTags(); ?> <!-- Open graph mark up --> <meta property="place:location:latitude" content="<?php echo Enterprise::About()->MapY; ?> "/> <meta property="place:location:longitude" content="<?php echo Enterprise::About()->MapX; ?> "/> <meta property="business:contact_data:street_address" content="<?php
/** * Finds the Meta model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Meta the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Seo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }