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


PHP SmartyPaginate::reset方法代碼示例

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


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

示例1: connect

 /**
  * initialize the session data
  *
  * @param string $id the pagination id
  * @param string $formvar the variable containing submitted pagination information
  */
 public static function connect($id = 'default', $formvar = null)
 {
     if (!isset($_SESSION['SmartyPaginate'][$id])) {
         SmartyPaginate::reset($id);
     }
     // use $_GET by default unless otherwise specified
     $_formvar = isset($formvar) ? $formvar : $_GET;
     // set the current page
     $_total = SmartyPaginate::getTotal($id);
     if (isset($_formvar[SmartyPaginate::getUrlVar($id)]) && $_formvar[SmartyPaginate::getUrlVar($id)] > 0 && (!isset($_total) || $_formvar[SmartyPaginate::getUrlVar($id)] <= $_total)) {
         $_SESSION['SmartyPaginate'][$id]['current_item'] = $_formvar[$_SESSION['SmartyPaginate'][$id]['urlvar']];
     }
 }
開發者ID:doio,項目名稱:Bittytorrent,代碼行數:19,代碼來源:SmartyPaginate.class.php

示例2: getSearchResults

<?php

#reset session data
SmartyPaginate::reset();
// required connect
SmartyPaginate::connect();
// set items per page
SmartyPaginate::setLimit(10);
#set url for links
SmartyPaginate::setUrl('./index.php?path=./main/faqs/faqs.show_faqs.php');
SmartyPaginate::setPrevText('PREV');
SmartyPaginate::setNextText('NEXT');
function getSearchResults(&$dbcon)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT fq.*,C.value FROM sionapros_faqs AS fq INNER JOIN sionapros_categories";
    $searchSQL .= " AS C ON fq.category = C.id ORDER BY C.id,fq.id LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    echo $dbcon->error;
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_faqs WHERE 1";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
開發者ID:jsan4christ,項目名稱:idrc-uganda-site,代碼行數:31,代碼來源:faqs.show_faqs.php


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