|
/*
*分页配置函数
*@loso
*@2011-11-24
*/
function pagination_up_down($con_class = NULL,$con_function = NULL,$con_params = NULL,$con_offset = NULL, $con_pagenum = NULL , $con_total = NULL)
{
if(!empty($con_class) && class_exists($con_class) && method_exists($con_class, $con_function))
{
return array(
'class_name' => $con_class,
'function_name' => $con_function,
'path_part' => $con_params,
'offset' => (int)$con_offset,
'pagenum' => (int)$con_pagenum,
'totalnum' => (int)$con_total
);
}
}
/**
* 获取数值参数
* @param $num 输入数值
* @param $min 最小值
* @param $max 最大值
* @param $default 默认值,为空表示必须有
* @loso
* @2011-11-24
*/
function getNumArg($num, $min, $max, $default = NULL)
{
$n = intval($num);
if(! isset($num) || ($n < $min || $n > $max))
{
if(isset($default))
{
return $default;
}
}
return $n;
}
$this->view->assign(pagination_up_down('pub', 'products', $path_part, $offsetnum, $this->pagenum, $ebook_counts));
<div class="pagerwrapper">
<div class="pagebar">
{if $totalnum > $pagenum}
{if $offset != 0}
<span class="fleft"><a href="/{$class_name}/{$function_name}/{$path_part}/{$offset-$pagenum}"><<上一页</a></span>
{/if}
<span class="fright"><a href="/{$class_name}/{$function_name}/{$path_part}/{$offset+$pagenum}">下一页>></a></span>
{/if}
</div>
</div>
|
|