public function index(Request $request) { $newsModel = new Models\NewsModel(); $onPage = 10; $page = intval($request->get('page')); $news = $newsModel->select($page, $onPage); $response = new Response(); $response->header('Content-type', 'application/json')->content(json_encode(['method' => 'newslist', 'result' => ['items' => $news, 'total' => 12, 'page' => $page, 'onpage' => $onPage, 'pages' => 2]])); return $response; }
public function newsList() { $newsModel = new NewsModel(); $data['list'] = $newsModel->getList(); echo View::render($data); }