当前位置:Gxlcms > PHP教程 > smarty分配的变量为啥在模板上输出不了

smarty分配的变量为啥在模板上输出不了

时间:2021-07-01 10:21:17 帮助过:23人阅读

smarty分配的变量为什么在模板上输出不了?
在网上找了一个分页类,加进自己需要的标签后,测试了一下,print_r可以打印输出,但是分配的到模板是空值,一时也没找到那出错了,请各位帮忙看看,急!
这个是修改的的分页类,pagediv.php


/*
//显示样式如下:
//[1] 2 3 4 5 6 7 8 9 10 ...100 下页 尾页
//首页 上页 1..12 13 14 15 [16] 17 18 19 20 ...100 下页 尾页
//首页 上页 1..92 93 94 95 96 97 98 [99] 100

//使用方法:
//$currentPage = $_GET['page']?$_GET['page']:1;
//$pagediv = new pagediv(500, 10, 11, $currentPage, 'test.php?page=');
//$pagediv->show();

*/
class pagediv
{
public $part1;
public $part2;
public $part3;
public $part4;
public $part5;

/*
对下面的分页显示进行分割:
首页 上页 1..12 13 14 15 [16] 17 18 19 20 ...100 下页 尾页
$part1 : 首页 上页
$part2 : 1..
$part3 : 12 13 14 15 [16] 17 18 19 20
$part4 : ...100
$part5 : 下页 尾页
*/

public $allPage; //总页数
public $allRocords; //总记录数
public $perPage; //每页记录数
public $showPagesNo; //显示分页栏的总页码数 显示样式里共有11个
public $currentPage; //当前页
public $urlModel; //Url链接样式

public $startHidden; //出现 1... 时的页数 开始隐藏中间页
public $endHidden; //出现 ...100 时的页数 结束隐藏中间页

public function __construct($allRocords, $perPage, $showPagesNo, $currentPage, $urlModel){
$this->allRocords = $allRocords;
$this->perPage = $perPage;
$this->showPagesNo = $showPagesNo;
$this->currentPage = $currentPage;
$this->urlModel = $urlModel;
$this->allPage = $this->getAllPage();

$this->startHidden = $this->getInt(($this->showPagesNo)/2); //6
$this->endHidden = $this->allPage - $this->startHidden; //94
}

public function getUrl($_index = ''){
$_current = $_index;
if($_index == 'pre') $_current = $this->currentPage -1;
if($_index == 'next') $_current = $this->currentPage+1;
if($_index == '') $_current = $this->allPage;

人气教程排行