user->identity; $seo = Yii::$app->get('seo'); $feedback = new Feedback(); $settings = Settings::getInstance(); $controller = Yii::$app->controller; $default_controller = Yii::$app->defaultRoute; $isHome = ( ( $controller->id === $default_controller ) && ( $controller->action->id === $controller->defaultAction ) ) ? true : false; $services = Service::find() ->where( [ 'status' => true, 'level' => 0, ] ) ->with( [ 'language.alias', 'services' => function (ActiveQuery $query) { $query->where([ 'status' => true ]) ->with( [ 'language.alias', 'services' => function (ActiveQuery $query) { $query->where([ 'status' => true ]) ->with([ 'language.alias' ]); }, ] ); }, ] ) ->orderBy('sort') ->all(); # для автоматической генерации SEO параметров (title/description) в ситуациях, когда этих параметров нету # мне нужно будет автоматически их подгенеривать, поэтому вместо $seo->title, которые является readOnly я использую эту переменную $seoTitleName = $seo->title; if ($seo->title == '' && \Yii::$app->controller->id == 'site' && \Yii::$app->controller->action->id == 'comments') { $currentServiceId = ( !empty(\Yii::$app->request->get('service_id')) ) ? \Yii::$app->request->get( 'service_id' ) : 0; $serviceModel = new Service([ 'id' => $currentServiceId ]); if ($currentServiceId !== 0) { $serviceName = $serviceModel->language->title; $seoTitleName = $this->params[ 'breadcrumbs' ][ 0 ] . ' - ' . $serviceName . ' - ' . \Yii::t( 'app', 'ABC short reverse' ); } else { $seoTitleName = $this->params[ 'breadcrumbs' ][ 0 ] . ' - ' . \Yii::t( 'app', 'General callbacks' ) . ' - ' . \Yii::t('app', 'ABC short reverse'); } } //----------------------------------------------------------------------------------------------------------------------- // Блок с микроразметкой для FB # $property нужно для property="og:type" FB switch (\Yii::$app->controller->id) { case "site": $property = 'website'; break; case "blog": $property = 'article'; break; case 'service': $property = 'product'; break; default: $property = 'website'; break; } $this->registerMetaTag( [ 'property' => 'og:description', 'content' => $seo->desc, ] ); $this->registerMetaTag( [ 'property' => "og:type", 'content' => $property, ] ); $this->registerMetaTag( [ 'property' => "og:url", 'content' => Url::current(), ] ); $this->registerMetaTag( [ 'property' => "og:title", 'content' => $seo->title, ] ); $this->registerMetaTag( [ 'name' => 'description', 'content' => ( \Yii::$app->controller->id == 'site' && \Yii::$app->controller->action->id == 'comments' && $seo->desc == null ) ? $seoTitleName : $seo->desc, ] ); //---------------------------------------------------------------------------------------------------------------------- $this->registerMetaTag( [ 'name' => 'robots', // 'content' => $seo->robots, 'content' => 'noindex,nofollow', ] ); $module = \Yii::$app->getModule('feedback'); $aliases = Alias::find() ->where([ 'route' => '{"0":"site/questions"}' ]) ->indexBy('route') ->andWhere([ 'language_id' => Language::getCurrent()->id ]) ->asArray() ->all(); $commentUrl = Alias::find() ->where([ 'route' => '{"0":"site/comments","service_id":0}' ]) ->indexBy('route') ->andWhere([ 'language_id' => Language::getCurrent()->id ]) ->asArray() ->all(); ?> beginPage() ?>
= Html::csrfMetaTags() ?>
= $settings->phone ?>
phone2)):?>
phone2); ?>
= Html::tag('p', $soloPhone2); ?>
|
= \Yii::t('app', 'Callback') ?> |