9ceb5beb
Alexey Boroda
-Blog started
|
1
|
<?php
|
8c596f14
Alexey Boroda
-Blog data provid...
|
2
|
|
9ceb5beb
Alexey Boroda
-Blog started
|
3
4
|
namespace frontend\controllers;
|
8c596f14
Alexey Boroda
-Blog data provid...
|
5
6
|
use artbox\weblog\models\Article;
use yii\data\ActiveDataProvider;
|
9ceb5beb
Alexey Boroda
-Blog started
|
7
|
use yii\web\Controller;
|
8c596f14
Alexey Boroda
-Blog data provid...
|
8
|
|
9ceb5beb
Alexey Boroda
-Blog started
|
9
10
11
12
13
14
15
16
17
|
/**
* Class BlogController
*
* @package frontend\controllers
*/
class BlogController extends Controller
{
public function actionIndex()
{
|
8c596f14
Alexey Boroda
-Blog data provid...
|
18
19
20
21
22
23
24
|
$query = Article::find()
->with('lang.alias')
->with('image')
->where([ 'status' => true ]);
$dataProvider = new ActiveDataProvider(
[
|
34082b1e
Alexey Boroda
-Comments added
|
25
26
27
28
|
'query' => $query,
'pagination' => [
'pageSize' => 3,
],
|
8c596f14
Alexey Boroda
-Blog data provid...
|
29
30
31
32
33
34
35
36
37
|
]
);
return $this->render(
'index',
[
'dataProvider' => $dataProvider,
]
);
|
9ceb5beb
Alexey Boroda
-Blog started
|
38
|
}
|
575afef8
Alexey Boroda
-Blog half way done
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
public function actionCategory()
{
$query = Article::find()
->with('lang.alias')
->with('image')
->where([ 'status' => true ]);
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
'pagination' => [
'pageSize' => 3,
],
]
);
return $this->render(
'index',
[
'dataProvider' => $dataProvider,
]
);
}
|
9ceb5beb
Alexey Boroda
-Blog started
|
63
|
}
|