當前位置: 首頁>>代碼示例>>PHP>>正文


PHP pagination::offset方法代碼示例

本文整理匯總了PHP中pagination::offset方法的典型用法代碼示例。如果您正苦於以下問題:PHP pagination::offset方法的具體用法?PHP pagination::offset怎麽用?PHP pagination::offset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pagination的用法示例。


在下文中一共展示了pagination::offset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: rtrim

             $sql .= $value_oby . ' ' . $search_asc_desc[$key_oby] . ' ,';
             $all_download_sql .= $value_oby . ' ' . $search_asc_desc[$key_oby] . ' ,';
         }
         $sql = rtrim($sql, ',');
         $all_download_sql = rtrim($all_download_sql, ',');
     } else {
         $sql .= ' ORDER BY ' . $search_order_by . ' ' . $search_asc_desc;
         $all_download_sql .= ' ORDER BY ' . $search_order_by . ' ' . $search_asc_desc;
     }
 }
 $total_count = $class::count_all_by_sql($count_sql);
 if (!empty($per_page)) {
     $pagination = new pagination($pageno, $per_page, $total_count);
     $pagination_statement = $pagination->show_pagination();
     $sql .= " LIMIT {$per_page} ";
     $sql .= " OFFSET {$pagination->offset()}";
 }
 $search_result = $class::find_by_sql($sql);
 if (method_exists($class, 'search_add_extra_fields')) {
     $class::search_add_extra_fields($search_result);
 }
 if (property_exists($class, 'search')) {
     foreach (${$class}->search as $searchParaKey => $searchParaValue) {
         $s->setProperty($searchParaKey, $searchParaValue);
     }
 }
 $s->setProperty('result', $search_result);
 $s->setProperty('_searching_class', $class);
 $s->setProperty('_search_order_by', filter_input(INPUT_GET, 'search_order_by'));
 $s->setProperty('_search_asc_desc', filter_input(INPUT_GET, 'search_asc_desc'));
 $s->setProperty('_per_page', $per_page);
開發者ID:prawee,項目名稱:inoERP,代碼行數:31,代碼來源:json_multi_select.php

示例2: pagination

</span> </p>
			
			<?php 
    /**
     * prepare to paginate comments
     * display paginated comments
     * built pagination link
     */
    //1. the current page number($current_page)
    $paginate = !empty($_GET['paginate']) ? (int) $_GET['paginate'] : 1;
    //2. records per page ($per_page)
    $per_page = 3;
    //3. total record count ($total_count)
    $total_count = $dbo->count_number_rows($comment_set);
    $pagination = new pagination($paginate, $per_page, $total_count);
    $offset = $pagination->offset();
    $comments = comment::paginate_comments($per_page, $offset);
    ?>
			
			<?php 
    while ($comment = $dbo->fetch_assoc($comments)) {
        $author = utility::remove_escape($comment["author"]);
        $content = utility::remove_escape($comment["body"]);
        echo "<p><code><strong>{$author}</strong><br />";
        echo " {$content} </code></p>";
    }
    ?>
			
			<div id="pagination"><?php 
    echo $pagination->built_pagination_links($paginate);
    ?>
開發者ID:vincentywang,項目名稱:simplenote,代碼行數:31,代碼來源:index.php


注:本文中的pagination::offset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。