示例#1
0
 function defaultAction()
 {
     $this->defaultData();
     $current_page = $this->getParameter('page') ? $this->getParameter('page') : 1;
     $offset = ($current_page - 1) * self::POSTS_PER_PAGE;
     $posts = $this->postsRepo->getPosts(self::POSTS_PER_PAGE, $offset, PostsRepository::ORDER_TOP);
     $this->view->posts = $posts;
     $this->view->action = 'default';
     $this->view->page = $current_page;
     $this->view->end = ceil($this->postsRepo->countPosts() / self::POSTS_PER_PAGE);
     $this->view->render('home/home');
 }