Commit 8c596f1430ec6e0f67e180d0c757a496de141ba7

Authored by Alexey Boroda
1 parent 9ceb5beb

-Blog data provider ready

frontend/controllers/BlogController.php
1 1 <?php
2   -
  2 +
3 3 namespace frontend\controllers;
4 4  
  5 + use artbox\weblog\models\Article;
  6 + use yii\data\ActiveDataProvider;
5 7 use yii\web\Controller;
6   -
  8 +
7 9 /**
8 10 * Class BlogController
9 11 *
... ... @@ -13,6 +15,22 @@
13 15 {
14 16 public function actionIndex()
15 17 {
16   - return $this->render('index');
  18 + $query = Article::find()
  19 + ->with('lang.alias')
  20 + ->with('image')
  21 + ->where([ 'status' => true ]);
  22 +
  23 + $dataProvider = new ActiveDataProvider(
  24 + [
  25 + 'query' => $query,
  26 + ]
  27 + );
  28 +
  29 + return $this->render(
  30 + 'index',
  31 + [
  32 + 'dataProvider' => $dataProvider,
  33 + ]
  34 + );
17 35 }
18 36 }
19 37 \ No newline at end of file
... ...
frontend/views/blog/_article.php 0 → 100644
  1 +<?php
  2 +
  3 + ?>
  4 +
  5 +
... ...
frontend/views/blog/index.php
... ... @@ -34,41 +34,6 @@
34 34 <p class="read-more"><a href="blog-post.html" class="btn btn-template-main">Continue reading</a>
35 35 </p>
36 36 </section>
37   -
38   -
39   - <section class="post">
40   - <h2><a href="blog-post.html">Who is who - example blog post</a></h2>
41   - <div class="row">
42   - <div class="col-sm-6">
43   - <p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a>
44   - </p>
45   - </div>
46   - <div class="col-sm-6">
47   - <p class="date-comments">
48   - <a href="blog-post.html"><i class="fa fa-calendar-o"></i> June 20, 2013</a>
49   - <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 Comments</a>
50   - </p>
51   - </div>
52   - </div>
53   - <div class="video">
54   - <div class="embed-responsive embed-responsive-16by9">
55   - <iframe class="embed-responsive-item" src="//www.youtube.com/embed/upZJpGrppJA"></iframe>
56   - </div>
57   -
58   - </div>
59   - <p class="intro">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean
60   - ultricies mi vitae est. Mauris placerat eleifend leo.</p>
61   - <p class="read-more"><a href="blog-post.html" class="btn btn-template-main">Continue reading</a>
62   - </p>
63   - </section>
64   -
65   - <ul class="pager">
66   - <li class="previous"><a href="#">&larr; Older</a>
67   - </li>
68   - <li class="next disabled"><a href="#">Newer &rarr;</a>
69   - </li>
70   - </ul>
71   -
72 37  
73 38 </div>
74 39 <!-- /.col-md-9 -->
... ... @@ -82,38 +47,26 @@
82 47  
83 48 <!-- *** MENUS AND WIDGETS ***
84 49 _________________________________________________________ -->
85   - <div class="panel panel-default sidebar-menu">
86   -
87   - <div class="panel-heading">
88   - <h3 class="panel-title">Text widget</h3>
89   - </div>
90   -
91   - <div class="panel-body text-widget">
92   - <p>Improved own provided blessing may peculiar domestic. Sight house has sex never. No visited raising gravity outward subject my cottage mr be. Hold do at tore in park feet near my case.
93   - </p>
94   -
95   - </div>
96   - </div>
97 50  
98   - <div class="panel panel-default sidebar-menu">
99   -
100   - <div class="panel-heading">
101   - <h3 class="panel-title">Search</h3>
102   - </div>
103   -
104   - <div class="panel-body">
105   - <form role="search">
106   - <div class="input-group">
107   - <input type="text" class="form-control" placeholder="Search">
108   - <span class="input-group-btn">
109   -
110   - <button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button>
111   -
112   - </span>
113   - </div>
114   - </form>
115   - </div>
116   - </div>
  51 +<!-- <div class="panel panel-default sidebar-menu">-->
  52 +<!-- -->
  53 +<!-- <div class="panel-heading">-->
  54 +<!-- <h3 class="panel-title">Search</h3>-->
  55 +<!-- </div>-->
  56 +<!-- -->
  57 +<!-- <div class="panel-body">-->
  58 +<!-- <form role="search">-->
  59 +<!-- <div class="input-group">-->
  60 +<!-- <input type="text" class="form-control" placeholder="Search">-->
  61 +<!-- <span class="input-group-btn">-->
  62 +<!---->
  63 +<!-- <button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button>-->
  64 +<!---->
  65 +<!-- </span>-->
  66 +<!-- </div>-->
  67 +<!-- </form>-->
  68 +<!-- </div>-->
  69 +<!-- </div>-->
117 70  
118 71 <div class="panel panel-default sidebar-menu">
119 72  
... ...