最新消息:本站所有跳转向bbs.ykit.cn的附件将全面停止,附件已转移到https://www.qingsj.com

帝国首页分页原理

帝国CMS 有客 742浏览
<? 
echo ‘<?php 
define("EmpireCMSAdmin","1"); 
require("e/class/connect.php"); 
require("e/class/db_sql.php"); 
require("e/class/functions.php"); 
require("e/class/delpath.php"); 
require("e/class/copypath.php"); 
require("e/class/t_functions.php"); 
require("e/data/dbcache/class.php"); 
require("e/data/dbcache/MemberLevel.php"); 
$link=db_connect(); 
$empire=new mysqlquery(); 
$_GET["page"]=(int)$_GET["page"]; 
if($_GET["page"]<=1||$_GET["page"]==""){ 
$_GET["page"]=1; 
} 
$no=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_download"); //总条数
$pageno=18;//每页页数 
$nopage=ceil($no/$pageno); //总页数 
$_GET["page"]=$_GET["page"]>$nopage ? 1:$_GET["page"]; 
$startid=($_GET["page"]-1)*$pageno; //开始id 
$limit ="limit".$startid.",".$pageno; 
if($nopage<2){ 
$limit=""; 
} 
$index="&nbsp;&nbsp;<a href=".$public_r[newsurl].">首页</a>&nbsp;&nbsp;"; 
$pageeof="&nbsp;&nbsp;<a href=".$public_r[newsurl]."?page=".$nopage.">尾页</a>&nbsp;&nbsp;"; 
if($_GET["page"]>1){ 
$page=$_GET["page"]-1; 
$pagepri="&nbsp;&nbsp;<a href=".$public_r[newsurl]."?page=".$page.">上一页</a>&nbsp;&nbsp;"; 
} 
else{ 
$pagepri="&nbsp;&nbsp;<a href=#>上一页</a>&nbsp;&nbsp;"; 
} 
if($_GET["page"]<$nopage){ 
$page=$_GET["page"]+1; 
$pagenext="&nbsp;&nbsp;<a href=".$public_r[newsurl]."?page=".$page.">下一页</a>&nbsp;&nbsp;";
} 
else{ 
$pagenext="&nbsp;&nbsp;<a href=#>下一页</a>&nbsp;&nbsp;"; 
} 
for($i=1;$i<=$nopage;$i++){ 
$selected=""; 
if($i==$_GET["page"]){ 
$selected="selected=selected"; 
} 
$selectedlist.="<option value=".$public_r[newsurl]."?page=".$i." ".$selected.">第".$i." 页</option>"; 
} 
?>‘; 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>[!--pagetitle--]</title> 
<meta name="keywords" content="[!--pagekey--]"> 
<meta name="description" content="[!--pagedes--]"> 
<link href="[!--news.url--]skin/kaoshi/css10down.css" rel="stylesheet" type="text/css"> 
<script src="[!--news.url--]skin/kaoshi/shu10.js" language="javascript" type="text/javascript"></script> 
<script type="text/javascript" src="[!--news.url--]skin/kaoshi/riqi.js"></script> 
</head> 
<body> 
[!--temp.header--] 
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0"> 
  <tr> 
    [!--temp.zuo--] 
    <td width="10"></td> 
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
        <td width="420" valign="top"> 
<div class="downinlist"> 
<? 
echo ‘<div class="pages"><?=$index?><?=$pagepri?><?=$pagenext?><?=$pageeof?>&nbsp;&nbsp;&nbsp;&nbsp;转到:<select name=select onchange="self.location.href=this.options[this.selectedIndex].value"><?=$selectedlist?></select></div> 
<div style=" font-size:0; height:4px;"></div> 
<?php 
$r=$empire->query("select * from {$dbtbpre}ecms_download".$limit.""); 
while($list=$empire->fetch($r)) 
{ 
$titleurl=sys_ReturnBqTitleLink($list); 
?> 
<table width="420" border="0" cellpadding="5" cellspacing="1" bgcolor="#eeeeee"> 
  <tr> 
    <td width="50" bgcolor="#FFFFFF"><font color=blue><?=date("m-d",$list["newstime"])?></font></td> 
    <td width="270" bgcolor="#FFFFFF"><a href="<?=$titleurl?>" target="_blank"><?=$list["title"]?></a></td> 
    <td width="50" align="center" bgcolor="#FFFFFF"><a href="<?=$public_r["newsurl"]?>e/DownSys/DownSoft/?classid=<?=$list["classid"]?>&id=<?=$list["id"]?>&pathid=0" target=balnk class="sixian" style="color:#F00">下载↓</a></td> 
  </tr> 
</table> 
<?php 
} 
db_close(); 
$empire=null; 
?> 
<div class="pages"><?=$index?><?=$pagepri?><?=$pagenext?><?=$pageeof?>&nbsp;&nbsp;&nbsp;&nbsp;转到:<select name=select onchange="self.location.href=this.options[this.selectedIndex].value"><?=$selectedlist?></select></div> 
‘; 
?> 
</div></td> 
        <td>&nbsp;</td> 
        <td width="339" valign="top"> 
<div style=" font-size:0; height:3px;"></div><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" background="[!--news.url--]skin/kaoshi/ra.gif"> 
          <tr> 
            <td width="3%">&nbsp;</td> 
            <td width="64%" style="font-size:14px; color:#666666"><strong>热门下载</strong></td> 
            <td width="33%">&nbsp;</td> 
          </tr> 
        </table> 
   <div class="ra1">           
[e:loop={0,10,4,0}] 
<a href=‘<?=$bqsr[titleurl]?>’ title=‘<?=$bqr[title]?>’ target=‘_blank’><?=$bqr[title]?></a><br /> 
[/e:loop]</div> 
   <div style=" font-size:0; height:6px;"></div> 
   <div class="downa2"><!–广告–></div> 
   <div style=" font-size:0; height:6px;"></div><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" background="[!--news.url--]skin/kaoshi/ra.gif"> 
          <tr> 
            <td width="3%">&nbsp;</td> 
            <td width="64%" style="font-size:14px; color:#666666"><strong>推荐下载</strong></td> 
            <td width="33%">&nbsp;</td> 
          </tr> 
        </table> 
   <div class="ra1">[e:loop={0,10,5,0}] 
<a href=‘<?=$bqsr[titleurl]?>’ title=‘<?=$bqr[title]?>’ target=‘_blank’><?=$bqr[title]?></a><br /> 
[/e:loop]</div>
</td> 
      </tr> 
    </table> </td> 
  </tr> 
</table> 
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0"> 
  <tr> 
    <td height="6"></td> 
  </tr> 
</table> 
[!--temp.footer--]</body> 
</html>

转载请注明:有客帮 » 帝国首页分页原理