1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
namespace app\controllers;
use app\models\anime;
class ContentController extends \lithium\action\Controller {
public $publicActions = array('anime');
public function index($type) //type has to equal something
{
switch($type) {
case "anime": $content = Anime::all(compact('limit','page','order'));
$total = Anime::count();
break;
case "manga":
case "kdrama": $content = Kdrama::all(compact('limit', 'page', 'order'));
$total = Kdrama::count();
break;
}
return compact('content', 'total', 'page', 'limit');
}
public function manga($id = null)
{
if ($id != null)
{
}
else
{
$content = Manga::all(compact('limit', 'page', 'order'));
$total = Manga::count();
}
}
public function anime($id = null)
{
$limit = 20;
$page = $this->request->page ?: 1;
$order = array('title' => 'ASC');
$content;
$total;
if ($id != null)
{
$content = Anime::find('first', array('conditions' => array('special_id' => $id), 'order' => array('title' => 'ASC')));
return compact('content');
}
else
{
$content = Anime::all(compact('limit','page','order'));
$total = Anime::count();
$this->render(array('template' => 'index', 'data' => compact('limit', 'page', 'content', 'total')));
}
}
}
|