<?php
define("totalPage","10");
require_once 'config.inc.php';
$currentPage=1;
$gt=$_GET["page"];
$gtt=$_GET["pageStype"];
if($_GET["page"]&& $_Get["PageStype"])
{
$currentPage=$_Get["page"];
$pageStype=$_Get["PageStype"];
if($pageStype=="down")
{
if(totalPage>$currentPage)
{
$currentPage++;
}
else
{
$currentPage=totalPage;
}
}
else if($pageStype="up")
{
if($currentPage>1)
{
$currentPage--;
}
else
{
$currentPage=1;
}
}
}
$Smarty->assign("pageStype",$pageStype);
$Smarty->assign("inforr",$Inforr);
$Smarty->assign("currentPage",$currentPage);
$Smarty->assign("totalPage",totalPage);
$Smarty->display("pageShow.html");
?>
模板<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title><{$pageStype}></title>
</head>
<body>
<form method="get" action="" name="dd">
<table><tr><td>共:<{$totalPage}></label>页 当前页:<{$currentPage}></td>
<td><a href="pageShow.php?page=<{$currentPage}>&PageStype=up" >上一页</a></td><td> <a href="pageShow.php?page=<{$currentPage}>&PageStype=down">下一页</a></td></tr></table>
</form>
</body>
</html>
这是我做的分页练习,为什么不能分页呢
define("totalPage","10");
require_once 'config.inc.php';
$currentPage=1;
$gt=$_GET["page"];
$gtt=$_GET["pageStype"];
if($_GET["page"]&& $_Get["PageStype"])
{
$currentPage=$_Get["page"];
$pageStype=$_Get["PageStype"];
if($pageStype=="down")
{
if(totalPage>$currentPage)
{
$currentPage++;
}
else
{
$currentPage=totalPage;
}
}
else if($pageStype="up")
{
if($currentPage>1)
{
$currentPage--;
}
else
{
$currentPage=1;
}
}
}
$Smarty->assign("pageStype",$pageStype);
$Smarty->assign("inforr",$Inforr);
$Smarty->assign("currentPage",$currentPage);
$Smarty->assign("totalPage",totalPage);
$Smarty->display("pageShow.html");
?>
模板<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title><{$pageStype}></title>
</head>
<body>
<form method="get" action="" name="dd">
<table><tr><td>共:<{$totalPage}></label>页 当前页:<{$currentPage}></td>
<td><a href="pageShow.php?page=<{$currentPage}>&PageStype=up" >上一页</a></td><td> <a href="pageShow.php?page=<{$currentPage}>&PageStype=down">下一页</a></td></tr></table>
</form>
</body>
</html>
这是我做的分页练习,为什么不能分页呢
输出信息看看各项是否都正常。
$Smarty->assign("inforr",$Inforr);
$Smarty->assign("currentPage",$currentPage);
$Smarty->assign("totalPage",totalPage);