Ver Fonte

description add date

amic há 1 ano atrás
pai
commit
8a24f48a1e
2 ficheiros alterados com 4 adições e 4 exclusões
  1. 1 1
      views/layouts/lenta/countdown.php
  2. 3 3
      views/news/view.php

+ 1 - 1
views/layouts/lenta/countdown.php

@@ -2,7 +2,7 @@
 
 $this->registerJs(
 <<<JS
-const deadline = new Date(2023, 9, 12);
+const deadline = new Date(2023, 9, 12, 23, 59, 59);
   // id таймера
   let timerId = null;
   // склонение числительных

+ 3 - 3
views/news/view.php

@@ -43,9 +43,9 @@ if( isset( $model->dt_pub ) && strtotime( $model->dt_pub ) < strtotime('2015-01-
 	$retina = $bad;
 };
  */
-
+$txt_date = date( "[Y-m-d] ", strtotime( $model->dt_pub ) );
 Yii::$app->og->title =($model->meta_title)?$model->meta_title:$model->title;
-Yii::$app->og->description = ($model->lid && trim($model->lid) <> '')?str_replace( '"', "&quot;", strip_tags($model->lid) ):trim(str_replace( '"',"'",substr(strip_tags( $model->text ),0,150)))."...";
+Yii::$app->og->description = ($model->lid && trim($model->lid) <> '')?str_replace( '"', "&quot;", strip_tags($model->lid) ):$txt_date.trim(str_replace( '"',"'",substr(strip_tags( $model->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';
@@ -56,7 +56,7 @@ if( $model->active == 'N' || $model->dt_pub > date("Y-m-d H:i:s") || $model->noi
     \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( '"',"&quot;",$model->meta_title)):strip_tags(str_replace( '"',"&quot;",$model->title)));
-    \Yii::$app->og->og_description = ($model->lid && trim($model->lid) <> '')?str_replace( '"',"&quot;",strip_tags($model->lid)):trim(str_replace( '"',"&quot;",substr(strip_tags( $model->text ),0,150)))."...";
+    \Yii::$app->og->og_description = ($model->lid && trim($model->lid) <> '')?str_replace( '"',"&quot;",strip_tags($model->lid)):$txt_date.trim(str_replace( '"',"&quot;",substr(strip_tags( $model->text ),0,150)))."...";
     \Yii::$app->og->dtpub = date( "r", strtotime( $model->dt_pub ) );
 }