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


PHP Paginator::set_parameters方法代碼示例

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


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

示例1: get_data

 public function get_data()
 {
     $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
     if (!empty($this->data["tableName"])) {
         $query = "SHOW TABLES FROM " . DB_NAME;
         $result = $mysqli->query($query);
         while ($row = $result->fetch_row()) {
             if (empty($this->tableName)) {
                 if ($row[0] == $this->data["tableName"]) {
                     $this->tableName = $row[0];
                 }
             }
         }
         $result->free();
         if (empty($this->tableName)) {
             $this->tableName = TABLENAME;
         }
     }
     if (!empty($this->data["selectors"]) or !empty($this->data["sorter"])) {
         $query = "SHOW COLUMNS FROM " . $this->tableName;
         $result = $mysqli->query($query);
         while ($row = $result->fetch_assoc()) {
             if (!empty($this->data['selectors'])) {
                 foreach ($this->data["selectors"] as $key->{$value}) {
                     if (empty($this->selectors[$key])) {
                         if ($row["Field"] == $key) {
                             $this->selectors[$key] = $value;
                         }
                     }
                 }
             }
             if (empty($this->sorter)) {
                 if ($row["Field"] == $this->data["sorter"]) {
                     $this->sorter = $row["Field"];
                 }
             }
         }
         $result->free();
         if (empty($this->sorter)) {
             $this->sorter = SORTER;
         }
     }
     $mysqli->close();
     $this->currentPage = is_numeric($this->data["currentPage"]) && $this->data["currentPage"] >= 1 ? $this->data["currentPage"] : CURRENTPAGE;
     $this->pcsPerPage = is_numeric($this->data["pcsPerPage"]) && $this->data["pcsPerPage"] >= 1 ? $this->data["pcsPerPage"] : PCSPERPAGE;
     $this->shownPages = is_numeric($this->data["shownPages"]) && $this->data["shownPages"] >= 1 ? $this->data["shownPages"] : SHOWNPAGES;
     $this->ascending = is_bool($this->data["ascending"]) ? $this->data["ascending"] : ASCENDING;
     $pager = new Paginator();
     echo "1" . !$this->data["ascending"];
     // echo($this->tableName.$this->currentPage.$this->sorter."'".$this->ascending."'".$this->pcsPerPage.$this->shownPages);
     $result = $pager->set_parameters($this->tableName, $this->currentPage, $this->sorter, $this->ascending, $this->pcsPerPage, $this->shownPages, $this->selectors);
     return $result;
 }
開發者ID:kitlum,項目名稱:pager,代碼行數:53,代碼來源:conditioner.class.php

示例2: Paginator

<?php

include "pager.php";
$a = new Paginator();
$b = $a->set_parameters();
$c = $b['pager'];
$d = $b['content'];
for ($i = 0; $i < count($c); $i++) {
    echo $c[$i] . "|";
}
開發者ID:kitlum,項目名稱:pager,代碼行數:10,代碼來源:index.php


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