$per_page = 1; // 3. total record count ($total_count) if ($new->visible == 1) { $total_count = News_Events::count_all(); } else { $total_count = News_Events::count_all_visible(); } // Find all photos // use pagination instead $pagination = new Pagination($page, $per_page, $total_count); // Instead of finding all records, just find the records // for this page $sql = "SELECT * FROM news_events ORDER BY `id` DESC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $newsEvents = News_Events::find_by_sql($sql); // Need to add ?page=$page to all links we want to // maintain the current page (or store $page in $session) $counter = 1; ?> <ul> <?php foreach ($newsEvents as $item) { switch ($item->iType) { case 1: $icon = '<i class="icon-user"></i>'; break; case 2: $icon = '<i class="icon-user"></i>';
$total_count = News_Events::count_all(); // Find all photos // use pagination instead $pagination = new Pagination($page, $per_page, $total_count); // Instead of finding all records, just find the records if (!empty($newsEvents)) { // for this page $sql = "SELECT * FROM news_events \r\n WHERE id != {$get_id}\r\n AND visible = 1\r\n AND verified_by !='' \r\n ORDER BY id DESC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $news_query = News_Events::find_by_sql($sql); } else { $sql = "SELECT * FROM news_events \r\n WHERE visible = 1\r\n AND verified_by !='' \r\n ORDER BY id DESC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $news_query = News_Events::find_by_sql($sql); } // Need to add ?page=$page to all links we want to // maintain the current page (or store $page in $session) $counter = 1; foreach ($news_query as $itemR) { ?> ffff <ul> <li style ="border"> <i class="icon-hand-right"></i> <a href="all_news.php?id=<?php echo customEncrypt($itemR->id); ?> "> <?php
<br> <br> <!-- Content --> <div class="row-fluid"> <?php include_layout_template('admin_menu.php'); ?> <div class="span9"> <h2>News</h2> <hr> <?php $query = "SELECT * FROM news_events ORDER BY id DESC"; $result = News_Events::find_by_sql($query); $pagecounter = 1; $serialno = 1; $max = 10; $number_of_notifications = sizeof($result); echo '<div class="tabbable"> <div class="tab-content">'; foreach ($result as $row) { if ($serialno % $max == 1) { if ($pagecounter == 1) { echo '<div class="tab-pane active" id="' . $pagecounter . '">'; } else { echo '<div class="tab-pane" id="' . $pagecounter . '">'; } echo '<table class="table table-hover"> <thead>
<?php include_layout_template("header.php"); ?> <!-- beginnning of main content--> <div class="container"> <div class="row-fluid"> <div class="span7" > <h4>Welcome to University of Jos Online Form Portal</h4> <hr> <h3><i class="icon-bullhorn"></i> NEWS</h3> <?php $query = "SELECT * FROM news_events\r\n WHERE visible = 1\r\n AND verified_by !='' \r\n \r\n ORDER BY id DESC LIMIT 2"; //int_r($query); $newsEvents = News_Events::find_by_sql($query); foreach ($newsEvents as $item) { switch ($item->iType) { case 1: $icon = '<i class="icon-user"></i>'; break; case 2: $icon = '<i class="icon-user"></i>'; break; default: $icon = '<i class="icon-user"></i>'; break; } ?> <p align="justify" >