Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 public function newsList()
 {
     $newsModel = new NewsModel();
     $data['list'] = $newsModel->getList();
     echo View::render($data);
 }