小盟 發表於 2023-6-18 00:00:00

帝国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>
&lt;select name="classid" id="classid"&gt;<br>
&lt;option value="0"&gt;所有栏目&lt;/option&gt;<br>
&lt;?=$class?&gt;<br>
&lt;/select&gt;</p>
<p>
<strong>改为:</strong></p>
<p>
&lt;select name="classid[]" size="12" multiple id="classid[]"&gt;<br>
&lt;option value="0"&gt;所有栏目&lt;/option&gt;<br>
&lt;?=$class?&gt;<br>
&lt;/select&gt;</p>
<p>
<strong>并且改进了e/admin/DoRehtml.php的代码如下:</strong><br>
 </p>
<div>

<p>
代码如下:</p>
</div>
<div id="phpcode1">
<br>
&lt;?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);&lt;/p&gt; &lt;p&gt;// 附加程序开始<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 &lt; $count1; $m++) {<br>
$classid = $add[$m];<br>
// 附加程序结束<br><br>
//刷新所有表<br>
if (!$count) {<br>
$j = 0;<br>
$tsql = $empire-&gt;query("select tbname from {$dbtbpre}enewstable order by tid"); // 帝国cms7.0版 这里有个条件为:where intb=0<br>
while ($tr = $empire-&gt;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&amp;classid=$classid&amp;from=$add&amp;retype=$add&amp;startday=$add&amp;endday=$add&amp;startid=$add&amp;endid=$add&amp;havehtml=$havehtml&amp;reallinfotime=" . time();<br>
echo "&lt;link href='../adminstyle/" . $loginadminstyleid . "/adminstyle.css' rel='stylesheet' type='text/css'&gt;<br>
&lt;center&gt;栏目id=$classid 要刷新的表的总个数为:&lt;font color=red&gt;$count&lt;/font&gt;个&lt;/center&gt;<br>
";<br>
for ($i = 0; $i &lt; $count; $i++) {<br>
$trueurl = $url . "&amp;tbname=" . $tbname[$i];<br>
echo "&lt;table width='100%' border=0 align=center cellpadding=3 cellspacing=1 class=tableborder&gt;&lt;tr class=header&gt;&lt;td&gt;刷新数据表:" . $tbname[$i] . "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td bgcolor='#ffffff'&gt;&lt;iframe frameborder=0 height=35 id='" . $tbname[$i] . "' scrolling=no src=\"" . $trueurl . "\" width=\"100%\"&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";<br>
}<br>
}<br>
db_close();<br>
$empire = null;<br>
?&gt;&lt;/p&gt; &lt;p&gt;&lt;iframe frameborder=0 height=35 id="checkrehtml" scrolling=no src="CheckRehtml.php?first=1&amp;from=&lt;?php echo $add ?&gt;" width="100%"&gt;&lt;/iframe&gt;</div>
頁: [1]
查看完整版本: 帝国cms后台实现刷新多栏目内容页的方法详解