コード例 #1
0
ファイル: FeedController.php プロジェクト: aprondak/ifphp
 /**
  * View feed information
  * 
  * @return void
  */
 public function viewAction()
 {
     //get flash messages
     $this->view->messages = $this->_flashMessenger->getMessages();
     $id = $this->getRequest()->getParam('id');
     //get feedinfo
     $feeds = new Feeds();
     $this->view->feed = $feeds->getBySlug($id);
     if (!$this->view->feed) {
         throw new Zend_Exception('Feed doesn\'t exist');
     }
     $this->view->feed->views++;
     $this->view->feed->save();
     //get posts
     $limit = 5;
     $page = $this->getRequest()->getParam('page') ? $this->getRequest()->getParam('page') : 1;
     $posts = new Posts();
     $this->view->posts = $posts->getByFeedId($this->view->feed->id, $page, $limit);
     $total = $posts->getByFeedId($this->view->feed->id, $page, 0, true)->total;
     $this->view->paginator = Zend_Paginator::factory($total);
     $this->view->paginator->setCurrentPageNumber($page);
     $this->view->paginator->setItemCountPerPage($limit);
     $this->view->keywords = implode('', array('ifphp', 'news aggragator', 'support,' . $this->view->feed->title));
     $this->view->description = 'ifPHP, The PHP news Aggragator: ' . $this->view->feed->description;
 }