public function action_index() { $page = Input::get('page') ? Input::get('page') : 1; $query = Input::get('query') ? Input::get('query') : ""; $blogs = Model_Blog::get_blogs($page, $query); $data['total_page'] = ceil($blogs['total'] / 30); $data['page'] = $page; $data['blogs'] = $blogs; $config = array('pagination_url' => "", 'total_items' => $blogs['total'], 'per_page' => 30, 'uri_segment' => 2, 'current_page' => $page); $pagination = Pagination::forge('pagenav', $config); $data['pagination'] = $pagination->render(); $data['featured_blogs'] = Model_Blog::get_featured_blogs(); $this->theme->set_template('index'); $this->theme->get_template()->set_global('current_menu', "Blogs", false); $this->theme->get_template()->set_global('current_menu_desc', "จัดการบล็อกทั้งหมดในระบบ", false); $this->theme->get_template()->set('breadcrumb', array(array('title' => "Home", 'icon' => "fa-home", 'link' => Uri::create('home'), 'active' => false), array('title' => "Blogs", 'icon' => "fa-rss", 'link' => "", 'active' => true))); $this->theme->get_template()->set_global('query', $query, false); $this->theme->set_partial('sidebar', 'common/sidebar'); $this->theme->set_partial('content', 'blog/index')->set($data); }