Beispiel #1
0
<div id="frontpage-location-listing">

<div class="row">
  <div class="col-md-12">
  <h3>Recent technical skills on offer</h3>

 <table class="table table-striped table-condensed table-list" id="list_main">
</table>

<!-- Larger pagination -->

<ul class="pagination pull-right">
<?php 
require "globals.php";
require "lib.php";
$total_pages = get_page_no($con, $config["listings"]["per_page"], $_GET["q"]);
$page_no = $_GET["p"];
$query = urlencode($_GET["q"]);
$pagination_links = 5;
if (!is_numeric($page_no)) {
    $page_no = 1;
} else {
    if ($page_no > $total_pages) {
        $page_no = 1;
    }
    if ($page_no < 1) {
        $page_no = 1;
    }
}
echo '<input id="current_page" type="hidden" value="' . $page_no . '">';
echo '<ul class="pagination pull-right">';
Beispiel #2
0
     break;
 case "list":
     //Get listings.
     $per_page_unsafe = $config["listings"]["per_page"];
     $per_page = mysql_real_escape_string($per_page_unsafe);
     $query = $_GET["q"];
     $query_unsafe = $_GET["q"];
     if (!empty($query)) {
         $query = mysql_real_escape_string(strtolower($query));
         $where = "AND `sell_skill` LIKE '%{$query}%'";
     } else {
         $where = "";
     }
     //Pagination.
     $page_no = $_POST["p"];
     $total_pages = get_page_no($con, $per_page, $query_unsafe);
     if (empty($page_no)) {
         $page_no = 1;
     }
     if (!is_numeric($page_no)) {
         $page_no = 1;
     }
     if ($page_no > $total_pages) {
         $page_no = 1;
     }
     if ($page_no < 1) {
         $page_no = 1;
     }
     $start = ($page_no - 1) * $per_page;
     $start = mysql_real_escape_string($start);
     $sql = "SELECT * FROM `listings` WHERE `visible`=1 {$where} ORDER BY `timestamp` DESC LIMIT {$start},{$per_page}";