当前位置: 首页>>代码示例>>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;未经允许,请勿转载。