本文整理汇总了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']];
}
}
示例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;