public function action_index($current_page = 1) { $config = array( 'pagination_url' => \Uri::create('blog/home/'), 'total_items' => Model_Article::count(), 'per_page' => \Settings::get('blog.perpage'), 'current_page' => (int) $current_page, ); \Pagination::set_config($config); $filters = array( 'limit' => \Pagination::$per_page, 'offset' => \Pagination::$offset ); $articles = Model_Article::get_all($filters); if(!$articles) { \Request::show_404(); } $data = array('articles' => $articles, 'pagination' => \Pagination::create_links()); $this->response->body(\View::factory('home_view', $data)); }
<div id="content"> <?php foreach($articles as $article) : ?> <h3><?php echo $article['title']; ?></h3> <?php endforeach; ?> <div class="pagination"> <?php echo $pagination; ?> </div> </div><!-- #content -->
It looks like you're new here. If you want to get involved, click one of these buttons!