/admin/users/add">New</a> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>#</th> <th>Email</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php $pagination = new Paginator(); $pagination_limit = 10; $users = $pagination->pagination($pagination_limit, 'user'); foreach ($users as $user) { echo '<tr>'; echo '<td>' . $user['id'] . '</td>'; echo '<td>' . $user['email'] . '</td>'; echo '<td><a class="btn btn-warning" href="' . BASE_URL . '/admin/users/edit?id=' . $user['id'] . '">Edit</a></td>'; echo '<td><a class="delete btn btn-danger" href="' . BASE_URL . '/admin/users/delete?id=' . $user['id'] . '">Delete</a></td>'; echo '</tr>'; } ?> </tbody> </table> <?php $pagination->pagination_links($pagination_limit, 'user'); ?> </div>
/admin/pages/add">New</a> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>#</th> <th>Title</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php $pagination = new Paginator(); $pagination_limit = 10; $pages = $pagination->pagination($pagination_limit, 'page'); foreach ($pages as $page) { echo '<tr>'; echo '<td>' . $page['id'] . '</td>'; echo '<td>' . $page['title'] . '</td>'; echo '<td><a class="btn btn-warning" href="' . BASE_URL . '/admin/pages/edit?id=' . $page['id'] . '">Edit</a></td>'; echo '<td><a class="delete btn btn-danger" href="' . BASE_URL . '/admin/pages/delete?id=' . $page['id'] . '">Delete</a></td>'; echo '</tr>'; } ?> </tbody> </table> <?php $pagination->pagination_links($pagination_limit, 'page'); ?> </div>
/admin/categories/add">New</a> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>#</th> <th>Title</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php $pagination = new Paginator(); $pagination_limit = 10; $categories = $pagination->pagination($pagination_limit, 'category'); foreach ($categories as $category) { echo '<tr>'; echo '<td>' . $category['id'] . '</td>'; echo '<td>' . $category['title'] . '</td>'; echo '<td><a class="btn btn-warning" href="' . BASE_URL . '/admin/categories/edit?id=' . $category['id'] . '">Edit</a></td>'; echo '<td><a class="delete btn btn-danger" href="' . BASE_URL . '/admin/categories/delete?id=' . $category['id'] . '">Delete</a></td>'; echo '</tr>'; } ?> </tbody> </table> <?php $pagination->pagination_links($pagination_limit, 'category'); ?> </div>
</a> <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div><!-- /.carousel --> <div class="container home"> <h1 class="page-header">Welcome</h1> <br/> <?php $pagination = new Paginator(); $pagination_limit = 3; $posts = $pagination->pagination($pagination_limit, 'post', ' WHERE status = 1'); foreach ($posts as $post) { if (!empty($post['featured'])) { echo '<a href="' . BASE_URL . '/blog/' . $post['id'] . '/' . $post['slug'] . '"><img class="img-responsive" src="' . BASE_URL . '/gw-content/uploads/' . $post['featured'] . '" alt="' . $post['title'] . '" /></a>'; } echo '<h2><a href="' . BASE_URL . '/blog/' . $post['id'] . '/' . $post['slug'] . '">' . $post['title'] . '</a></h2>'; $categories = db_select("SELECT * FROM category WHERE id in (" . $post['category_id'] . ")"); echo '<div class="small">'; $created_date = $post['created_date']; $posted_date = date("F jS, Y", strtotime($created_date)); echo '<span class="glyphicon glyphicon-calendar"></span> ' . $posted_date; echo ' '; echo '<span class="glyphicon glyphicon-folder-open"></span> '; foreach ($categories as $category) { echo '<a href="' . BASE_URL . '/blog/category/' . $category['id'] . '/' . $category['slug'] . '">' . $category['title'] . '</a> '; }
/admin/posts/add">New</a> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>#</th> <th>Title</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php $pagination = new Paginator(); $pagination_limit = 10; $posts = $pagination->pagination($pagination_limit, 'post'); foreach ($posts as $post) { echo '<tr>'; echo '<td>' . $post['id'] . '</td>'; echo '<td>' . $post['title'] . '</td>'; echo '<td><a class="btn btn-warning" href="' . BASE_URL . '/admin/posts/edit?id=' . $post['id'] . '">Edit</a></td>'; echo '<td><a class="delete btn btn-danger" href="' . BASE_URL . '/admin/posts/delete?id=' . $post['id'] . '">Delete</a></td>'; echo '</tr>'; } ?> </tbody> </table> <?php $pagination->pagination_links($pagination_limit, 'post'); ?> </div>
<div class="container"> <h1 class="page-header"><?php echo $category['title']; ?> </h1> <p><?php if (!empty($category['description'])) { echo $category['description']; } ?> </p> <?php $searched_id = $category_lookup->category_id_search($category['id'], $id); $pagination = new Paginator(); $pagination_limit = 3; $posts = $pagination->pagination($pagination_limit, 'post', ' WHERE category_id = ' . $searched_id . ' AND status = 1'); foreach ($posts as $post) { if (!empty($post['featured'])) { echo '<a href="' . BASE_URL . '/blog/' . $post['id'] . '/' . $post['slug'] . '"><img class="img-responsive" src="' . BASE_URL . '/gw-content/uploads/' . $post['featured'] . '" alt="' . $post['title'] . '" /></a>'; } echo '<h2><a href="' . BASE_URL . '/blog/' . $post['id'] . '/' . $post['slug'] . '">' . $post['title'] . '</a></h2>'; $categories = db_select("SELECT * FROM category WHERE id in (" . $post['category_id'] . ")"); echo '<div class="small">'; $created_date = $post['created_date']; $posted_date = date("F jS, Y", strtotime($created_date)); echo '<span class="glyphicon glyphicon-calendar"></span> ' . $posted_date; echo ' '; echo '<span class="glyphicon glyphicon-folder-open"></span> '; foreach ($categories as $category) { echo '<a href="' . BASE_URL . '/blog/category/' . $category['id'] . '/' . $category['slug'] . '">' . $category['title'] . '</a> '; }
/** * Pagination with query and row count (better for large sets of data) * * @param string $query - SQL query * @param int $total_items - total row count * @param int $items_per_page * @param string $cache_table - must provide a table, e.g. "posts" for caching to be used * @return object|false - object */ public function pagination($query, $total_items, $items_per_page = 10, $cache_table = '') { require_once LIBS . 'Paginator.php'; $paginator = new Paginator(); return $paginator->pagination($this, $query, $total_items, $items_per_page, $cache_table); }