posts new Posts postCategories new PostCategories this- view- current_

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$posts = new Posts;
$postCategories = new PostCategories;
$this->view->current_category = $cat_name;
$items_per_page = 10;
$select = $this->db->select()
->from(DB_PREFIX . 'posts')
->order('adddate DESC')
;
if ($cat_name) {
$cat_id = $postCategories->getCatIDBySEO($cat_name);
$select->where('cat_id = ' . (int)$cat_id);
}
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
$paginator->setCurrentPageNumber($this->_getParam('page', 1))
->setItemCountPerPage($items_per_page)
->setPageRange(20)
;
$this->view->pagerHTML = $this->view->paginationControl($paginator, 'Sliding', 'index/pager_vertical.phtml', array('cat_name' => $cat_name));