123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <?php
- use yii\web\View;
- use yii\helpers\ArrayHelper;
- use app\modules\ldjson\jsonLD;
- use yii\web\UrlManager;
- use app\models\Authors;
- use app\models\base\Image;
- use \app\models\news;
- use yii\helpers\Url;
- foreach( $obj->css as $item ){
- echo '<link href="/'.$obj->dir.'css/'.$item.'" rel="stylesheet">';
- }
- foreach( $obj->js as $item ){
- echo '<script src="/'.$obj->dir.'js/'.$item.'" charset="utf-8" defer></script>';
- }
- echo '<script src="https://www.amic.ru/project/all/tilda/dvazhdy-ordenonosnyy-'.$id.'/js/tilda-blocks-page'.$id.'.min.js" ></script>';
- ?>
- <script src="/project/all/tilda/dvazhdy-ordenonosnyy-30604619/js/tilda-slds-1.4.min.js" charset="utf-8" async onerror="this.loaderr='y';"></script>
- <script src="/project/all/tilda/dvazhdy-ordenonosnyy-30604619/js/tilda-events-1.0.min.js" charset="utf-8" async onerror="this.loaderr='y';"></script>
- <style>
- header div{box-sizing: border-box}
- .t456.t456__positionabsolute{
- top: auto;
- left: 0px;
- }
- .t-title{ line-height: 100%; }
- </style>
- <script type="text/javascript">
- function t_onReady(func) {
- if (document.readyState != 'loading') {
- func();
- } else {
- document.addEventListener('DOMContentLoaded', func);
- }
- }
- function t_onFuncLoad(funcName, okFunc, time) {
- if (typeof window[funcName] === 'function') {
- okFunc();
- } else {
- setTimeout(function() {
- t_onFuncLoad(funcName, okFunc, time);
- },(time || 100));
- }
- }function t_throttle(fn, threshhold, scope) {return function () {fn.apply(scope || this, arguments);};}</script>
- <script type="text/javascript">(function () {
- if((/bot|google|yandex|baidu|bing|msn|duckduckbot|teoma|slurp|crawler|spider|robot|crawling|facebook/i.test(navigator.userAgent))===false && typeof(sessionStorage)!='undefined' && sessionStorage.getItem('visited')!=='y' && document.visibilityState){
- var style=document.createElement('style');
- style.type='text/css';
- style.innerHTML='@media screen and (min-width: 980px) {.t-records {opacity: 0;}.t-records_animated {-webkit-transition: opacity ease-in-out .2s;-moz-transition: opacity ease-in-out .2s;-o-transition: opacity ease-in-out .2s;transition: opacity ease-in-out .2s;}.t-records.t-records_visible {opacity: 1;}}';
- document.getElementsByTagName('head')[0].appendChild(style);
- function t_setvisRecs(){
- var alr=document.querySelectorAll('.t-records');
- Array.prototype.forEach.call(alr, function(el) {
- el.classList.add("t-records_animated");
- });
- setTimeout(function () {
- Array.prototype.forEach.call(alr, function(el) {
- el.classList.add("t-records_visible");
- });
- sessionStorage.setItem("visited", "y");
- }, 400);
- }
- document.addEventListener('DOMContentLoaded', t_setvisRecs);
- }
- })();</script>
- <?
- $preview = $model->image;
- $retina = $preview->getUrl(Image::SIZE_1040x586,"jpg");
- $normal = $preview->getUrl(Image::SIZE_841x473,"webp");
- $bad = $preview->getUrl(Image::SIZE_680x383,'jpg');
- $bad = $bad?$bad:'/images/default.jpg';
- if( $retina === false || $normal === false ){
- $normal = $bad;
- $retina = $bad;
- }
- $normal .= "?v=".$model->rev;
- $retina .= "?v=".$model->rev;
- $bad .= "?v=".$model->rev;
- /*
- После этой даты не выводить фото до подтверждения юриста
- if( isset( $model->dt_pub ) && strtotime( $model->dt_pub ) < strtotime('2015-01-01 00:00:00') ){
- $bad = '/images/default.jpg';
- $normal = $bad;
- $retina = $bad;
- };
- */
- $txt_date = date( "[Y-m-d] ", strtotime( $model->dt_pub ) );
- $body_text = strip_tags( preg_replace('/<(script|style)\b[^>]*>(.*?)<\/(script|style)>/is', "", $html) );
- Yii::$app->og->title =($model->meta_title)?$model->meta_title:$model->title;
- Yii::$app->og->description = ($model->lid && trim($model->lid) <> '')?str_replace( '"', """, strip_tags($model->lid) ):$txt_date.trim(str_replace( '"',"'",substr(strip_tags( $body_text ),0,150)))."...";
- if( $model->active == 'N' || $model->dt_pub > date("Y-m-d H:i:s") || $model->noindex == 'Y' ){
- Yii::$app->og->noindex = 'Y';
- }else{
- \Yii::$app->og->canonical = $model->getUrl(true);
- \Yii::$app->og->amp = Url::base('https').'/amp/news/'.$model->id;
- \Yii::$app->og->og_url = $model->getUrl(true);
- \Yii::$app->og->og_image = $model->image->url;
- \Yii::$app->og->og_type = "article";
- \Yii::$app->og->og_title = htmlspecialchars(($model->meta_title)?strip_tags(str_replace( '"',""",$model->meta_title)):strip_tags(str_replace( '"',""",$model->title)));
- \Yii::$app->og->og_description = ($model->lid && trim($model->lid) <> '')?str_replace( '"',""",strip_tags($model->lid)):$txt_date.trim(str_replace( '"',""",substr(strip_tags( $body_text ),0,150)))."...";
- \Yii::$app->og->dtpub = date( "r", strtotime( $model->dt_pub ) );
- }
- jsonLD::addAmicORG();
- jsonLD::news( $model->title, preg_replace('/\s+/', ' ', str_replace( ["\n","\r"],' ',Yii::$app->og->description)), $model->image->url, $model->dt_pub, $model->getUrl(), $model->uid, $body_text, $model->meta_title);
- jsonLD::addfaq($body_text, $model->title);
- $story = new \app\models\base\Story();
- $this->params['breadcrumbs'] = [
- [
- "text"=>"НОВОСТИ",
- "url"=>"/news"
- ]
- ];
- $this->params['context'] = "post-view";
- //$topic = ArrayHelper::getValue($model->topics,0);
- $topic = Yii::$app->cache->getOrSet('topic-news-'.$model->id, function () use($model){
- return $model->getTopics()->andWhere(['show'=>"Y","active"=>1])->orderBy('order asc')->one();
- }, News::$keysCache['topic-news-##']);
- if($topic instanceof \app\models\base\NewsTopic){
- $this->params['breadcrumbs'][] =
- [
- "text"=>$topic->title,
- "url"=>"/news/".mb_strtolower($topic->url)
- ];
- }
- $i = 1;
- foreach($this->params['breadcrumbs'] as $el){
- jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
- $i++;
- }
- if( $model->show_author == 'Y' )
- {
- $author = Authors::getAuthor( $model->author );
- $authorName = $author->name;
- \Yii::$app->og->author =$authorName;
- jsonLD::author( $authorName );
- }else{
- $authorName = 'ИА Амител';
- jsonLD::author( $authorName, false );
- }
- $GLOBALS['type_long'] = ($model->type == 6); //лонгрид
- echo $html;
|