示例#1
0
function customPaging($sql, $ListRecPerPage = 20, $rewrite_url = false)
{
    //var_dump($rewrite_url);
    global $link;
    //===============Paging========================
    //$ListRecPerPage = 10;
    $pg = new paging($link, "page", $ListRecPerPage, "»", "«", 5, @$CurlLink);
    $pg->sql = $sql;
    $r = $pg->get_page_result();
    // result set
    $num_rows = $pg->get_page_num_rows();
    // number of records in result set
    $data = array();
    if ($num_rows > 0) {
        while ($o = GetArr($r)) {
            array_push($data, $o);
        }
    }
    mysql_data_seek($r, 0);
    //if( @$iscurl )
    //$nav_links = $pg->navigation_curl(" | ", "price" ); // the navigation links (define a CSS class selector for the current link)
    //else $separator = " | ", $css_current = "", $back_forward = false, $rewrite_url = false
    $nav_links = $pg->navigation(" ", "current", false, $rewrite_url);
    // the navigation links (define a CSS class selector for the current link)
    $nav_info = $pg->page_info("to");
    // information about the number of records on page ("to" is the text between the number)
    $simple_nav_links = $pg->back_forward_link();
    // the navigation with only the back and forward links
    $total_recs = $pg->get_total_rows();
    // the total number of records*/
    //=============================================
    return array('data' => $data, 'result' => $r, 'total_recs' => $total_recs, 'nav_links' => $nav_links, 'nav_info' => $nav_info, 'simple_nav_links' => $simple_nav_links);
}