电脑技术学习

帝国cms建站:栏目二级域名绑定后来“顶一下”、评论“支持”和“反对”无法正常使用

dn001

  帝国cms建站系统,栏目设置正常,但栏目二级域名绑定后来顶一下无法正常使用,一点击就会有错误digg 提示:“there was a problem with the request”,用论坛搜索出解决的办法,http://bbs.phome.net/ShowThread/?threadid=109472&forumid=13  但是按照这方法操作了还是没用啊。原来是ajax不支持跨域,二级域名不能用ajax,修改链接就可以了。

“顶一下”原代码为:

<a href="JavaScript:makeRequest('[--news.url--]e/public/digg?classid=[!--classid--]&id=[!--id--]&dotop=1&doajax=1&ajaxarea=diggnum','EchoReturnedText','GET','');">来顶一下</a>

“顶一下”的链接修改为以下:

<a href="[--news.url--]e/public/digg/?classid=[!--classid--]&id=[!--id--]&dotop=1&doajax=0&ajaxarea=diggnum">来顶一下</a>

内容页评论列表中,“支持”、“反对”的代码在“/e/pl/more/index.php”文件中,将文件内容替换为以下代码:

<?php
require("../../class/connect.php");
eCheckCloseMods('pl');//关闭模块
$id=(int)$_GET['id'];
$classid=(int)$_GET['classid'];
$num=(int)$_GET['num'];
if($num<1||$num>80)
{
    $num=10;
}
$doaction=$_GET['doaction']=='dozt'?'dozt':'';
require("../../class/db_sql.php");
require("../../class/q_functions.php");
$link=db_connect();
$empire=new mysqlquery();
//专题
if($doaction=='dozt')
{
    if(empty($classid))
    {
        exit();
    }
    //信息
    $infor=$empire->fetch1("select ztid,restb from {$dbtbpre}enewszt where ztid='$classid' limit 1");
    if(!$infor['ztid'])
    {
        exit();
    }
    $pubid='-'.$classid;
}
else
{
    if(empty($id)||empty($classid))
    {
        exit();
    }
    include("../../data/dbcache/class.php");
    if(empty($class_r[$classid]['tbname']))
    {
        exit();
    }
    //信息
    $infor=$empire->fetch1("select classid,restb from {$dbtbpre}ecms_".$class_r[$classid]['tbname']." where id='$id' limit 1");
    if(!$infor['classid']||$infor['classid']!=$classid)
    {
        exit();
    }
    $pubid=ReturnInfoPubid($classid,$id);
}
//排序
$addorder='plid desc';
$myorder=(int)$_GET['myorder'];
if($myorder==1)
{
    $addorder='plid';
}
$sql=$empire->query("select * from {$dbtbpre}enewspl_".$infor['restb']." where pubid='$pubid' and checked=0 order by ".$addorder." limit ".$num);
?>
document.write("");
<?php
while($r=$empire->fetch($sql))
{
    $plusername=$r[username];
    if(empty($r[username]))
    {
        $plusername='匿名';
    }
    if($r[userid])
    {
        $plusername="<a href='$public_r[newsurl]e/space/?userid=$r[userid]' target='_blank'>$r[username]</a>";
    }
    $saytime=date('Y-m-d H:i:s',$r['saytime']);
    //ip
    $sayip=ToReturnXhIp($r[sayip]);
    $saytext=str_replace("\r\n","",$r['saytext']);
    $saytext=addslashes(RepPltextFace(stripSlashes($saytext)));//替换表情
?>
document.writeln("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"1\" style=\"word-break:break-all; word-wrap:break-all;\">        <tr>           <td height=\"30\"><span class=\"name\">本站网友 <?=$plusername?><\/span> <font color=\"#666666\">ip:<?=$sayip?><\/font><\/td>          <td><div align=\"right\"><font color=\"#666666\"><?=$saytime?> 发表<\/font><\/div><\/td>        <\/tr>        <tr valign=\"top\">           <td height=\"50\" colspan=\"2\" class=\"text\"><?=$saytext?><\/td>        <\/tr>        <tr>           <td height=\"30\">&nbsp;<\/td>          <td><div align=\"right\" class=\"re\">               <a href=\"\/e\/pl\/doaction.php?enews=DoForPl&plid=<?=$r[plid]?>&classid=<?=$classid?>&id=<?=$id?>&dopl=1&doajax=1&ajaxarea=zcpldiv<?=$r[plid]?>\">支持<\/a>[<span id=\"zcpldiv<?=$r[plid]?>\"><?=$r[zcnum]?><\/span>]&nbsp;               <a href=\"\/e\/pl\/doaction.php?enews=DoForPl&plid=<?=$r[plid]?>&classid=<?=$classid?>&id=<?=$id?>&dopl=0&doajax=1&ajaxarea=fdpldiv<?=$r[plid]?>\">反对<\/a>[<span id=\"fdpldiv<?=$r[plid]?>\"><?=$r[fdnum]?><\/span>]            <\/div><\/td>        <\/tr>      <\/table>      <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">        <tr>          <td background=\"http:\/\/www.pc004.com\/skin\/default\/images\/plhrbg.gif\"><\/td>        <\/tr>      <\/table>");
<?php
}
?>
document.write("");
<?php
db_close();
$empire=null;
?>

需要强调的是,链接中“doajax=1”一定要改为“doajax=0”。

更多帝国CMS使用技巧,请访问http://www.pc004.com/cms/ecms/

标签: