php smarty 分页怎么在html中调用
$pagesize=3;$url=$_SERVER["REQUEST_URI"];$url=parse_url($url);$url=$url['path'];$numq...
$pagesize=3;
$url=$_SERVER["REQUEST_URI"];
$url=parse_url($url);
$url=$url['path'];
$numq=mysql_query("SELECT * FROM `qb_article`");
$num = mysql_num_rows($numq);
[email]$page=@$_GET['page'[/email]];
if(isset($_GET['page'])){
$pageval=$_GET['page'];
$page=($pageval-1)*$pagesize;
$page.=',';
}
if($num > $pagesize){
if(@$pageval<=1)$pageval=2;
echo "共 $num 条".
" <a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页</a>";
}
$SQL="SELECT * FROM qb_article limit $page $pagesize ";
$query=mysql_query($SQL);
while($row=@mysql_fetch_array($query)){
echo "<br>".$row['title'];
} 展开
$url=$_SERVER["REQUEST_URI"];
$url=parse_url($url);
$url=$url['path'];
$numq=mysql_query("SELECT * FROM `qb_article`");
$num = mysql_num_rows($numq);
[email]$page=@$_GET['page'[/email]];
if(isset($_GET['page'])){
$pageval=$_GET['page'];
$page=($pageval-1)*$pagesize;
$page.=',';
}
if($num > $pagesize){
if(@$pageval<=1)$pageval=2;
echo "共 $num 条".
" <a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页</a>";
}
$SQL="SELECT * FROM qb_article limit $page $pagesize ";
$query=mysql_query($SQL);
while($row=@mysql_fetch_array($query)){
echo "<br>".$row['title'];
} 展开
展开全部
页:echo "共 $num 条".
" <a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页
改成 $page="共 $num 条<a href=$url?page=($pageval-1)>上一页</a> <a href=$url?page=($pageval+1)>下一页</a>"; $smarty->assign("page",$page);
标题:echo "<br>".$row['title'];改成$title[]=array("title"=>$row['title']); 在while外面加入一句$smarty->assign("title",$title);
还有疑问。。。。
" <a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页
改成 $page="共 $num 条<a href=$url?page=($pageval-1)>上一页</a> <a href=$url?page=($pageval+1)>下一页</a>"; $smarty->assign("page",$page);
标题:echo "<br>".$row['title'];改成$title[]=array("title"=>$row['title']); 在while外面加入一句$smarty->assign("title",$title);
还有疑问。。。。
追问
你好 能加你QQ 教教我吗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询