/** * @return \yii\db\ActiveQuery */ public static function About() { $section = Yii::$app->db->cache(function () { return Enterprise::find()->where(['enabled' => 1])->all(); }, 1); return $section[0]; }
public function actionContacts() { $session = Yii::$app->session; $user_id = $session->get('user_id'); //телефон, адрес, координаты $contacts = \common\models\Enterprise::findOne(['enabled' => 1]); return $this->render('/enterprise/contacts', ['contacts' => $contacts]); }
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]); }
<meta property="business:contact_data:street_address" content="<?php echo Enterprise::About()->street; ?> "/> <meta property="business:contact_data:locality" content="<?php echo Enterprise::About()->city; ?> "/> <meta property="business:contact_data:postal_code" content="454000"/> <meta property="business:contact_data:country_name" content="Россия"/> <meta property="business:contact_data:email" content="<?php echo Enterprise::About()->email; ?> "/> <meta property="business:contact_data:phone_number" content="<?php echo Enterprise::About()->phone; ?> "/> <meta property="business:contact_data:website" content="<?php echo Yii::$app->getUrlManager()->createAbsoluteUrl(''); ?> "/> <meta name="google-site-verification" content="_kITV-EJJB3x2ibRcK1BTviXU07KQm3MVhYR5xZuStU" /> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/images/apple-touch-icon-114x114-precomposed.png" /> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/images/apple-touch-icon-72x72-precomposed.png" /> <link rel="apple-touch-icon-precomposed" href="/images/apple-touch-icon-57x57-precomposed.png" /> <link rel="shortcut icon" href="favicon.png" /> <?php $this->head(); ?> </head>