Guest User

Problém s Routou

a guest
May 17th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Presenters;
  4.  
  5. use Nette;
  6.  
  7. class SablonyPresenter extends BasePresenter
  8. {
  9.     /** @persistent */
  10.     public $page;
  11.    
  12.     public function renderDefault($page){
  13.         $this->template->LastNews = $this->database->table('news')->order('time ASC')->limit(5);
  14.         $this->template->Templates = $this->database->table('templates')->order('id DESC')->where('id < ' . (($this->page * 12) + 1 ) . ' AND id > '. (($this->page * 12) - 12 ));
  15.         $this->template->page = $this->page;
  16.         $NumRows = $this->database->table('news')->count("*");
  17.         $this->template->NumRows = $NumRows;
  18.         $this->template->NumPages = $NumRows / 12; 
  19.     }
  20.    
  21.     public function createRoute(){
  22.         $route = new Route('<presenter>/<action>[/<page>]', 'Sablony:default');
  23.         return $route;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment