public function catpage() { //0-based pagination if ($this->f3->get('PARAMS.number') != '') { $pagenumber = $this->f3->get('PARAMS.number') - 1; } else { $pagenumber = 0; } //number of items $catcount = new Item($this->db); $catcount_number = $catcount->catcountByTok($this->f3->get('PARAMS.tok')); $this->f3->set('catcount_number', $catcount_number); $tgs = new Item($this->db); //$catsall = $tgs->all(); //without pagination $catsall = $tgs->loadpagesByTok($pagenumber * $this->f3->get('itemlimit'), $this->f3->get('itemlimit'), $this->f3->get('PARAMS.tok')); $this->f3->set('items', $catsall); //number of items $this->f3->set('itemcount', $catcount_number); //assigne tags to items $tgs = new TagList($this->db); $tgslst = $tgs->getCatTags($this->f3->get('PARAMS.tok')); $tgsarray = array(); $j = 0; foreach ($tgslst as $i) { $tgsarray[$i['itok']][$j]['tok'] = $i['tok']; $tgsarray[$i['itok']][$j]['url'] = $i['url']; $tgsarray[$i['itok']][$j]['label'] = $i['label']; $j++; } $this->f3->set('tgsarray', $tgsarray); $this->f3->set('tgs', $tgslst); $this->f3->set('header', 'Tag List'); $this->f3->set('view', 'item/list.htm'); $this->f3->set('catmenu', $this->f3->get('PARAMS.tok')); //get category label $tgsl = new Cat($this->db); $tgsl->getById($this->f3->get('PARAMS.tok')); $this->f3->set('label', $this->f3->get('POST.name')); //menu $this->f3->set('topmenu', 'c'); //pagination $this->f3->set('pagecount', ceil($this->f3->get('itemcount') / $this->f3->get('itemlimit'))); $this->f3->set('page', $pagenumber); $this->f3->set('pagemodule', 'c/' . $this->f3->get('PARAMS.tok')); //breadcrumbs $this->f3->set('breadcrumb', array(array("url" => '/c', "name" => "Categories"), array("url" => NULL, "name" => $this->f3->get('POST.name')))); }