Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Presenters;
- use Nette;
- class SablonyPresenter extends BasePresenter
- {
- /** @persistent */
- public $page;
- public function renderDefault($page){
- $this->template->LastNews = $this->database->table('news')->order('time ASC')->limit(5);
- $this->template->Templates = $this->database->table('templates')->order('id DESC')->where('id < ' . (($this->page * 12) + 1 ) . ' AND id > '. (($this->page * 12) - 12 ));
- $this->template->page = $this->page;
- $NumRows = $this->database->table('news')->count("*");
- $this->template->NumRows = $NumRows;
- $this->template->NumPages = $NumRows / 12;
- }
- public function createRoute(){
- $route = new Route('<presenter>/<action>[/<page>]', 'Sablony:default');
- return $route;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment