Blame view

frontend/views/articles/index.php 2.54 KB
5842c37f   Administrator   big commti
1
2
  <?php
      use common\modules\comment\assets\CommentAsset;
5181a91a   Administrator   big commti
3
4
  use frontend\widgets\Seo;
  use yii\helpers\Html;
5842c37f   Administrator   big commti
5
6
7
8
9
10
11
12
13
      use yii\helpers\Url;
      use yii\widgets\Breadcrumbs;
      //use app\models\News;
      use yii\widgets\LinkPager;
      use frontend\components\Text;
      Yii::$app->getModule('artbox-comment');
      CommentAsset::register($this);
  ?>
  <?php
fceda630   Administrator   big commti
14
      $this->title = 'Статьи';
5842c37f   Administrator   big commti
15
  
5181a91a   Administrator   big commti
16
17
      $this->params[ 'seo' ][ Seo::H1] =  $this->title ;
      $this->params[ 'seo' ][ Seo::TITLE] = $this->title;
5842c37f   Administrator   big commti
18
19
20
21
22
  
      $this->params['breadcrumbs'][] = $this->title;
  
      $this->registerMetaTag([
          'name'    => 'description',
fceda630   Administrator   big commti
23
          'content' => 'Статьи',
5842c37f   Administrator   big commti
24
25
26
      ]);
      $this->registerMetaTag([
          'name'    => 'keywords',
fceda630   Administrator   big commti
27
          'content' => 'Статьи',
5842c37f   Administrator   big commti
28
29
30
31
32
33
34
35
36
37
38
39
      ]);
  ?>
  
      
  <div class="container">
      <h1>Блог</h1>
  
      <?php foreach($news as $item): ?>
          <div class="news_item">
              <a href="<?= Url::to([
                  'articles/show',
                  'translit' => $item->translit,
5842c37f   Administrator   big commti
40
41
42
43
44
45
              ]) ?>">
                  <?= Html::img(\common\components\artboximage\ArtboxImageHelper::getImageSrc($item->imageUrl, 'list'), [ 'class' => 'float-left' ]) ?>
              </a>
              <a href="<?= Url::to([
                  'articles/show',
                  'translit' => $item->translit,
5842c37f   Administrator   big commti
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
              ]) ?>" class="name"><?= $item->title ?></a><br/>
              <div class="comment_display_block article_list_comment">
                  <?php
                      if(!empty( $item->averageRating && $item->averageRating->value > 0 )) {
                          ?>
                          <div class="rateit" data-rateit-value="<?php echo $item->averageRating->value; ?>" data-rateit-readonly="true" data-rateit-ispreset="true"></div>
                          <?php
                      }
                  ?>
                  <p>
                      <?php
                          $comment_count = count($item->comments);
                          echo Html::a(( $comment_count ? 'Отзывов: ' . count($item->comments) : "Оставить отзыв" ), [
                              'articles/show',
                              'translit' => $item->translit,
5842c37f   Administrator   big commti
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
                              '#'        => 'artbox-comment',
                          ]);
                      ?>
                  </p>
              </div>
              <?= Text::getShort($item->body, 600); ?>
              <div class="both"></div>
          </div>
      <?php endforeach; ?>
  
      <div class="both"></div>
      <?= LinkPager::widget([
          'pagination'       => $pages,
          'registerLinkTags' => true,
      ]); ?>
  
  </div>