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


PHP Pager::build方法代码示例

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


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

示例1: Exception

    if ($db->forum_group > $acl->group) {
        throw new Exception("Access denied");
    }
    echo "<span style='float:left; font-weight: normal;'><h2>" . $db->forum_name . "</h2></span>";
    $this->setTitle($db->forum_name);
    $db = new DB("forum_topics");
    $db->setColPrefix("topic_");
    $db->join("left", "{PREFIX}forum_posts", "post_topic", "topic_id");
    $db->setSort("topic_sticky DESC, post_added DESC");
    $db->select("topic_forum = '" . $db->escape($id) . "' GROUP BY post_topic");
    $perpage = 40;
    $pager = new Pager();
    $pager->perpage = $perpage;
    $pager->count = $db->numRows();
    $pager->href = array("forums", "view-forum", $arg);
    $pager->build();
    echo $pager->pager_top;
    ?>
    <br />
    <a href="<?php 
    echo page("forums", "create-topic", "", "", "", "forum=" . $id);
    ?>
" style="float:right;"><span class="btn"><?php 
    echo _t("Create new topic");
    ?>
</span></a>
    <br /><br />
    <table width="100%" cellpadding="5" cellspacing="0" class="forum">
        <thead>
            <tr>
                <td width="46px" class=""></td>
开发者ID:thefkboss,项目名称:openTracker,代码行数:31,代码来源:view-forum.php

示例2: search

 function search($page = 1, $searchQuery = null, $sort = "id")
 {
     $m = $this->model;
     $temp = new $m();
     $searchQueryParsed = Options::parse($searchQuery);
     $where = array();
     $queryData = new stdClass();
     foreach ($searchQueryParsed as $key => $value) {
         if (APP_USE_LANGUAGE) {
             if ($value != "" && $value != null) {
                 if (isset($m->{$key})) {
                     $where[] = $temp->__table__ . ".{$key} LIKE \"%{$value}%\"";
                 } else {
                     $where[] = $temp->__table__ . ".{$key}_{$this->application->language} LIKE \"%{$value}%\"";
                 }
             }
         } else {
             if ($value != "" && $value != null) {
                 $where[] = $temp->__table__ . ".{$key} LIKE \"%{$value}%\"";
             }
         }
         $queryData->{$key} = $value;
     }
     $query = array();
     //if($this->order!=null) $query["order"] = $this->order;
     if ($sort != null) {
         $query["order"] = "{$temp->__table__}.{$sort}";
     }
     $query["group"] = $temp->__table__ . ".id";
     $query["limit"] = ($page - 1) * $this->perPage . "," . $this->perPage;
     $query["founds"] = true;
     if (count($where) > 0) {
         $query["where"] = implode(" AND ", $where);
     }
     /*
     if($condition!=null){
     	$query["where"] = $condition;
     }
     */
     $this->data["objects"] = Collection::load($this->model, $query, $total);
     $order = new stdClass();
     foreach ($this->orderFields as $key) {
         $order->{$key} = $key;
         $sym = $key . "symbol";
         $order->{$sym} = "[asc]";
         if ($key == $sort) {
             $order->{$key} .= " desc";
             $order->{$sym} = "[desc]";
         }
     }
     $this->data["order"] = $order;
     import("data.Pager");
     $page = max($page, 1);
     unset($this->data["objects"]["founds"]);
     $pager = new Pager($total, $this->perPage);
     $pager->to = "{$this->controller}/search/{page}/{$searchQuery}";
     $this->data["pager"] = $pager->build($page);
     $this->data["querydata"] = $queryData;
     $this->data["uri"] = linkForm("/{$this->controller}/search/{$page}/{$searchQuery}");
     $this->setView("{$this->folder}/{$this->subView}", $this->data);
 }
开发者ID:NerdZombies,项目名称:MateCode,代码行数:61,代码来源:Scaffolder.php


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