帝国cms后台实现刷新多栏目内容页的方法详解
<p><span><font color="#ff0000">以下代码适用于帝国CMS6.6版,<span>7.0版不同处在代码注释处已标明。</span></font></span><br><img style="max-width:100%!important;height:auto!important;"title="帝国cms后台实现刷新多栏目内容页的方法详解" alt="帝国cms后台实现刷新多栏目内容页的方法详解" src="https://zhuji.jb51.net/uploads/img/202305/d4f25b4c8b029235cfa9af3622c57df9.jpg"></p>
<p>
<strong>找到e/admin/ChangeData.php文件</strong></p>
<p>
原先的栏目是<span>单选菜单</span></p>
<p>
<select name="classid" id="classid"><br>
<option value="0">所有栏目</option><br>
<?=$class?><br>
</select></p>
<p>
<strong>改为:</strong></p>
<p>
<select name="classid[]" size="12" multiple id="classid[]"><br>
<option value="0">所有栏目</option><br>
<?=$class?><br>
</select></p>
<p>
<strong>并且改进了e/admin/DoRehtml.php的代码如下:</strong><br>
</p>
<div>
<p>
代码如下:</p>
</div>
<div id="phpcode1">
<br>
<?php<br>
define('EmpireCMSAdmin', '1');<br>
require ("../../class/connect.php");<br>
require ("../../class/db_sql.php");<br>
require ("../../class/functions.php");<br>
$link = db_connect();<br>
$empire = new mysqlquery();<br>
$editor = 1;<br>
//验证用户<br>
$lur = is_login();<br>
$logininid = $lur['userid'];<br>
$loginin = $lur['username'];<br>
$loginrnd = $lur['rnd'];<br>
$loginlevel = $lur['groupid'];<br>
$loginadminstyleid = $lur['adminstyleid'];<br>
$add = $_GET;<br>
$havehtml = (int)$add['havehtml'];<br>
$tbname = $add['tbname'];<br>
$count = count($tbname);</p> <p>// 附加程序开始<br>
if (!is_array($add['classid'])) { //传递非数组值时,在栏目里点击"信息"操作时使用<br>
$add['classid'] = array( $add['classid'] );<br>
}<br>
if ($add['classid'] == 0) {<br>
$add['classid'] = array(0);<br>
}<br>
$count1 = count($add['classid']);<br>
for ($m = 0; $m < $count1; $m++) {<br>
$classid = $add[$m];<br>
// 附加程序结束<br><br>
//刷新所有表<br>
if (!$count) {<br>
$j = 0;<br>
$tsql = $empire->query("select tbname from {$dbtbpre}enewstable order by tid"); // 帝国cms7.0版 这里有个条件为:where intb=0<br>
while ($tr = $empire->fetch($tsql)) {<br>
$tbname[$j] = $tr;<br>
$j++;<br>
}<br>
$count = count($tbname);<br>
}<br>
esetcookie("retablenum", $count, 0, 1);<br>
esetcookie("rechecktablenum", 0, 0, 1);<br>
$url = "../ecmschtml.php?enews=ReNewsHtml&classid=$classid&from=$add&retype=$add&startday=$add&endday=$add&startid=$add&endid=$add&havehtml=$havehtml&reallinfotime=" . time();<br>
echo "<link href='../adminstyle/" . $loginadminstyleid . "/adminstyle.css' rel='stylesheet' type='text/css'><br>
<center>栏目id=$classid 要刷新的表的总个数为:<font color=red>$count</font>个</center><br>
";<br>
for ($i = 0; $i < $count; $i++) {<br>
$trueurl = $url . "&tbname=" . $tbname[$i];<br>
echo "<table width='100%' border=0 align=center cellpadding=3 cellspacing=1 class=tableborder><tr class=header><td>刷新数据表:" . $tbname[$i] . "</td></tr><tr><td bgcolor='#ffffff'><iframe frameborder=0 height=35 id='" . $tbname[$i] . "' scrolling=no src=\"" . $trueurl . "\" width=\"100%\"></iframe></td></tr></table>";<br>
}<br>
}<br>
db_close();<br>
$empire = null;<br>
?></p> <p><iframe frameborder=0 height=35 id="checkrehtml" scrolling=no src="CheckRehtml.php?first=1&from=<?php echo $add ?>" width="100%"></iframe></div>
頁:
[1]