function list_all() { $page = (int) $this->uri->segment(3, 1); $page = $page ? $page : 1; $items_per_page = 7; $dm = new DataManager($this->dm_profile); $dm->setItemsPerPage($items_per_page); $dm->setPage($page); $dm->setMode('list'); $dm->setOrderingField('id', 0); if ($dm->loadData() === false) { var_dump($dm->getErrors()); exit; } $data['pages_count'] = $dm->getPagesCount(); $message = $this->uri->segment(4); switch ($message) { case 'deleted': $data['message'] = 'Item deleted.'; break; case 'saved': $data['message'] = 'Item saved.'; break; default: $data['message'] = ''; } $data['titles'] = $dm->getTitles(); $data['fields'] = $dm->getFields(); $data['controller'] = $this->controller; $data['page'] = $this->controller . '/list'; $this->load->view('main_tpl', $data); }