当前位置: 首页>>代码示例>>PHP>>正文


PHP core::pagination方法代码示例

本文整理汇总了PHP中core::pagination方法的典型用法代码示例。如果您正苦于以下问题:PHP core::pagination方法的具体用法?PHP core::pagination怎么用?PHP core::pagination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core的用法示例。


在下文中一共展示了core::pagination方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mainPage

 public static function mainPage()
 {
     $allCount = self::$db->query("SELECT COUNT(*) as cnt, c.`contentID`, cc.`contentID` FROM `content` as c, " . "`content_category` as cc WHERE cc.`contentID`=c.`contentID` AND c.`showOnSite`='Y'")->fetch();
     $sqlData = blog::getPosts(core::pagination($allCount["cnt"]))->fetchAll();
     //if ($sqlData)
     //{
     //blog::highlightCode ($sqlData, "short");
     //}
     return $sqlData;
 }
开发者ID:ygres,项目名称:sblog,代码行数:10,代码来源:model.index.php

示例2: date

 function date()
 {
     system::setParam("page", "blogByDate");
     $offset = 1;
     if (isset($this->get["offset"])) {
         $offset = intval($this->get["offset"]);
     }
     $cacheID = "DTSELECT|ARTICLE|dateoffset_{$offset}";
     if (isset($this->args[1])) {
         $date = preg_replace("/[^0-9.]/uims", '', $this->args[1]);
         $cacheID = $date . "|" . $cacheID;
     }
     $this->smarty->setCacheID($cacheID);
     if (!$this->smarty->isCached()) {
         $allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` as c, `content_category` as cc, `categories` as cts WHERE \n            cc.`contentID`=c.`contentID` AND c.`type`='article' AND cts.`categoryID`=cc.`catID` AND c.`showOnSite`='Y' AND c.`dt` >= \n            STR_TO_DATE ('?', '%d.%m.%Y')", $date)->fetch();
         $posts = news::getPostsByDate($date, core::pagination($allCount["cnt"], $offset), "article")->fetchAll();
         $this->smarty->assign("posts", $posts);
         $this->smarty->assign("date", $date);
     }
 }
开发者ID:ygres,项目名称:sblog,代码行数:20,代码来源:index.php

示例3: buildList

 public static function buildList($target, $type = "", array $clause = array())
 {
     if ($type) {
         if ($target == "categories") {
             // временный костыль
             $clause[] = "`catType`='{$type}'";
         } else {
             $clause[] = "`type`='{$type}'";
         }
     }
     $clauseSTR = "";
     if ($clause) {
         $clauseSTR = implode(" AND ", $clause);
     }
     if ($clauseSTR) {
         $clauseSTR = "WHERE {$clauseSTR}";
     }
     $columns = self::$db->query("SHOW COLUMNS FROM `{$target}`")->fetchAll();
     if (isset($_GET["action"])) {
         switch ($_GET["action"]) {
             case "delete":
                 $id = array_keys($_GET);
                 $keyName = $id[count($_GET) - 1];
                 $id = intval($_GET[$keyName]);
                 self::$db->query("DELETE FROM `{$target}` WHERE `?`=?", $keyName, $id);
                 if ($target == "content") {
                     self::$db->query("DELETE FROM `content_category` WHERE `id`=?", $id);
                     self::$smarty->clearCache(null, "MAINPAGE|SEARCH_RES|BLOG|CATSELECT|RSS");
                 }
                 break;
         }
     }
     if (isset($_POST["groupDelete"]) && !empty($_POST["rows"])) {
         self::$db->query("DELETE FROM `{$target}` WHERE `" . $columns[0]["Field"] . "` IN (" . implode(",", $_POST["rows"]) . ")");
     }
     $mysqlLimits = array();
     $offset = 0;
     $allCount = self::$db->query("SELECT COUNT(*) as cnt FROM `{$target}` {$clauseSTR}")->fetch();
     $mysqlLimits = core::pagination($allCount["cnt"]);
     $sort = $columns[0]["Field"];
     $direction = "DESC";
     if (isset($_GET["direction"]) && $_GET["direction"]) {
         if ($_GET["direction"] == "DESC") {
             $direction = "ASC";
         } else {
             if ($_GET["direction"] == "ASC") {
                 $direction = "DESC";
             }
         }
     }
     if (isset($_GET["sort"]) && $_GET["sort"]) {
         $sort = $_GET["sort"];
     }
     self::$smarty->assign("direction", $direction);
     self::$smarty->assign("sort", $sort);
     $res = self::$db->query("SELECT * FROM `{$target}` {$clauseSTR} ORDER BY `{$sort}` {$direction} LIMIT \n\t\t\t{$mysqlLimits["start"]},{$mysqlLimits["end"]}");
     if ($target != "categories") {
         $res->runAfterFetchAll[] = array("blog", "makeSlug");
     }
     $data = $res->fetchAll();
     self::$smarty->assign("list", $data);
     return $data;
 }
开发者ID:ygres,项目名称:sblog,代码行数:63,代码来源:model.blog.php

示例4: mailOutbox

 public static function mailOutbox($offset = 1)
 {
     $userID = intval($_SESSION["user"]["userID"]);
     $_SESSION["user"]["mail"]["box"] = "outbox";
     $cntOut = self::$db->query("SELECT COUNT(*) as cnt FROM `messages`,`users` WHERE `userID`=`senderID` AND `userID`=?", $userID)->fetch();
     $cntIn = self::$db->query("SELECT COUNT(*) as cnt FROM `messages` WHERE `receiverID`=?", $userID)->fetch();
     self::$smarty->assign("cntOut", $cntOut["cnt"]);
     self::$smarty->assign("cntIn", $cntIn["cnt"]);
     $limits = core::pagination($cntIn["cnt"], $offset);
     return self::$db->query("SELECT * FROM `messages` as m LEFT JOIN " . "`users` as u ON u.`userID`=m.`receiverID` WHERE m.`senderID`=? ORDER BY m.`dt` DESC LIMIT " . implode(",", $limits), $userID);
 }
开发者ID:ygres,项目名称:sblog,代码行数:11,代码来源:model.user.php


注:本文中的core::pagination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。