Blame view

frontend/views/blog/index.php 2.26 KB
30a01994   Timur Kastemirov   blog
1
2
3
4
5
6
7
8
9
10
11
12
13
  <?php
      /**
       * User: timur
       * Date: 26.01.18
       * Time: 8:49
       *
       * @var View $this
       * @var ActiveDataProvider $dataProvider
       */
      
      use yii\web\View;
      use yii\data\ActiveDataProvider;
      use yii\widgets\ListView;
58728e08   Timur Kastemirov   объекты бэк правк...
14
15
16
17
      use common\models\Settings;
      use frontend\widgets\SearchWidget;
      use frontend\widgets\CategoryWidget;
      use frontend\widgets\TagWidget;
3f932702   Timur Kastemirov   blog seo and remo...
18
      use yii\helpers\Url;
30a01994   Timur Kastemirov   blog
19
      
58728e08   Timur Kastemirov   объекты бэк правк...
20
21
      $settings = Settings::getInstance();
      
3f932702   Timur Kastemirov   blog seo and remo...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
      switch (Yii::$app->controller->action->id){
          
          case "search":
              $this->params['h1'] = \Yii::t('app', 'Blog Search');
              break;
          case "category":
              $this->params['h1'] = \Yii::t('app', 'Blog Category');
              break;
          case "tag":
              $this->params['h1'] = \Yii::t('app', 'Blog Tag');
              break;
          default:
              $this->params['h1'] = \Yii::t('app', 'menu-blog');
              break;
              
      }
      
      if ( Yii::$app->controller->action->id !== Yii::$app->controller->defaultAction ){
          $this->params[ 'breadcrumbs' ][] = [
              'label' => Yii::t('app', "menu-blog"),
              'url' => Url::toRoute(['blog/index'])
          ];
      }
      
58728e08   Timur Kastemirov   объекты бэк правк...
46
47
48
      $this->params[ 'breadcrumbs' ][] = $this->params['h1'];
      
  ?>
30a01994   Timur Kastemirov   blog
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  
  <div id="content">
      <div class="container">
          <div class="row">
      
              <div class="col-md-9" id="blog-listing-big">
          
                  <?=ListView::widget(
                      [
                          'dataProvider' => $dataProvider,
                          'itemView'     => '_article_item',
                          'layout' => '{items}{pager}',
                          'pager' => [
                              'disableCurrentPageButton' => true,
                              'registerLinkTags' => true,
                          ],
                      ]
                  )?>
      
              </div>
58728e08   Timur Kastemirov   объекты бэк правк...
69
70
71
      
              <div class="col-md-3">
              
2309b955   Timur Kastemirov   blog categories &...
72
73
74
75
76
77
                  <?=SearchWidget::widget(
                      [
                          'route' => 'blog/search'
                      ]
                  )?>
                  
58728e08   Timur Kastemirov   объекты бэк правк...
78
                  <?=CategoryWidget::widget()?>
2309b955   Timur Kastemirov   blog categories &...
79
                  
58728e08   Timur Kastemirov   объекты бэк правк...
80
81
82
83
                  <?=TagWidget::widget()?>
              
              </div>
      
30a01994   Timur Kastemirov   blog
84
85
86
          </div>
      </div>
  </div>