帝国cms教程

帝国CMS二次开发自定义后台查询列表示例

精准像素 2022-03-16 人阅读
<?php
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
require('../../data/dbcache/class.php');
require "../".LoadLang('pub/fun.php');
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//验证用户
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
$search=$ecms_hashur['ehref'];
$page=(int)$_GET['page'];
$start=0;
$line=$htag_r['pagenum'];
if(!$line){
$line=20;
}
$page_line=20;//每页显示链接数
$offset=$page*$line;//总偏移量
$query="select * from {$dbtbpre}ecms_news";
$totalquery="select count(*) as total from {$dbtbpre}ecms_news";
$num=$empire->gettotal($totalquery);//取得总条数
$query=$query." order by id desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page2($num,$line,$page_line,$start,$page,$search);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../../data/images/qcss.css" rel="stylesheet" type="text/css">
<script src="jquery.min.js"></script>
<title>自定义列表</title>
<script> 
function sltall(checkstatus){
var d=document.getElementById("form2");
var i; 
for(i=0;i<d.elements.length;i++){ 
if(d.elements[i].type=="checkbox" && d.elements[i].name!="plidq"){ 
d.elements[i].checked=checkstatus;
}
}
} 
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td>位置:自定义列表</td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableborder">
<tr class="header">
            <td align="center" height="30">ID</td>
            <td align="center">标题</td>
</tr>
<?
   while($r=$empire->fetch($sql))
  {
  ?>
<tr>
            <td height="30" align="center" bgcolor="#FFFFFF">
<?=$r["id"];?>
</td>
            <td height="30" align="center" bgcolor="#FFFFFF">
<?=$r["title"];?>
</td>
            </tr>
<? } ?>
        <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="8"> 
       <?=$returnpage;?>
        </td>
    </tr>
</table>
</body>
</html>
<?php
db_close();
$empire=null;
?>