这里是普通文章模块栏目内容页
dede二次开发织梦

DEDE 区分 PC / 手机端 js (手机端PC端对应跳转)

<script type="text/javascript"> 
function mobile_device_detect(url) 

  if(window.location.pathname != '/'){ 
    url += window.location.pathname; 
  } 
  if(window.location.search != ''){ 
    url += window.location.search; 
  } 
  var thisOS = navigator.platform; 
  var device = new Array("iPhone","iPod","iPad","android","Nokia","SymbianOS","Symbian","Windows Phone","Phone","Linux armv71","MAUI","UNTRUSTED/1.0","Windows CE","BlackBerry","IEMobile"); 
  for(var i=0;i<device.length;i++) 
  { 
    if(thisOS.match(device[i])) 
    { 
      window.location=url; 
    } 
  } 
  //因为相当部分的手机系统不知道信息,这里是做临时性特殊辨认 
  if(navigator.platform.indexOf('iPad') != -1) 
  { 
    window.location=url; 
  } 
  //做这一部分是因为Android手机的内核也是Linux 
  //但是navigator.platform显示信息不尽相同情况繁多,因此从浏览器下手,即用navigator.appVersion信息做判断 
  //------ 测试这部分导致不管pc还是手机都跳到手机端,所以先注释不用,测试就通过了!  ------- 
  //var check = navigator.appVersion; 
  //if( check.match(/linux/i) ) 
  //{ 
    //X11是UC浏览器的平台 ,如果有其他特殊浏览器也可以附加上条件 
  //  if(check.match(/mobile/i) || check.match(/X11/i)) 
  //  { 
  //    window.location=url; 
  //  } 
  //} 
  //类in_array函数 
  Array.prototype.in_array = function(e) 
  { 
    for(i=0;i<this.length;i++) 
    { 
      if(this[i] == e) 
      return true; 
    } 
    return false; 
  } 
   

mobile_device_detect("http://地址/m"); 
</script>  

DEDE分页js

/**
* 分页
* thisPage 当前页
* allPage  总页数
* url 跳转地址
* idName   选择器id名称(放置分页的位置)
* showNum  展示几个页码
*/ 
function getPageShow(thisPage,allPage,rdurl,idName,showNum){ 
    var str = '<ul>'; 
    if(rdurl){ 
    } 
    //根据当前页计算前后页数 
    var leftPage_num  = Math.floor( showNum / 2 ); 
    var rightPage_num = showNum - leftPage_num; 
 
    //左边显示数为当前页减左边该显示的数 例如总显示7页 当前页是5  左边最小为5-3  右边为5+3 
    var left  = thisPage - leftPage_num; 
        left  = Math.max(left,1);       //左边最小不能小于1 
    var right = left + showNum - 1;     //左边加显示页数减1就是右边显示数 
        right = Math.min(right, allPage);       //右边最大不能大于总页数 
        left  = Math.max(right - showNum + 1 , 1); //确定右边再计算左边,必须二次计算 
 
    if (thisPage > 1) { 
        str    += '<li><a href=" '+ rdurl + (Number(thisPage)-1) +'">上一页</a></li>'; 
    }else{ 
        str    += '<li><a href="'+ rdurl + thisPage +'">上一页</a></li>'; 
    } 
    if(left > 1){ 
        str    += ' ..'; 
    } 
    for (var i = left; i <= right; i++) 
    {    
        if(thisPage == i){ 
            str    += '<li><a class="now_page" href="'+ rdurl + i +'">'+ i +'</a></li>'; 
        } 
        else{ 
            str    += '<li><a href="'+ rdurl + i +'">'+ i +'</a></li>'; 
        } 
    } 
    if(right < allPage){ 
        str    += ' ..'; 
    } 
    if (thisPage == allPage) { 
        str    += '<li><a href="'+ rdurl + allPage +'">下一页</a></li>'; 
    }else{ 
        str    += '<li><a href="'+ rdurl + (Number(thisPage)+1) +'">下一页</a></li>'; 
    } 
    str    += '</ul>'; 
 
    $("." + idName).html(str); 

 
 
function getRequest() { 
    var url = location.search; //获取url中"?"符后的字串 
    var theRequest = new Object(); 
    if (url.indexOf("?") != -1) { 
        var str = url.substr(1); 
        strs = str.split("&"); 
        for ( var i = 0; i < strs.length; i++) { 
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 
        } 
    } 
    return theRequest; 
}  

在DEDEcms的/member和/plus文件夹下,有许多模板需要调用当前模板的头部和尾部,同时使用同一个变量<?php pasterTempletDiy("head.htm"); ?>会出现问题,plus能正常使用,而会员中心却打不开,其实解决办法很简单,就是单独写变量。方法如下:

会员部分打开/member/config.php,在最下面添加如下代码

//引入arc.partview.class.php类处理   
require_once(DEDEINC."/arc.partview.class.php");   
function pasterTempletDiy($path)   
{   
    global $cfg_basedir,$cfg_templets_skin;   
    $tmpfile = $cfg_basedir.$cfg_templets_skin."/".$path;//模版文件的路径   
    $dtp = new PartView();   
    $dtp->SetTemplet($tmpfile);   
    $dtp->Display();   
}   

对应模板用:

<?php pasterTempletDiy("head.htm"); ?> 
<?php pasterTempletDiy("footer.htm"); ?>  

/plus文件部分,把变量pasterTempletDiy换成变量pasterTempletDiy2即可:
//引入arc.partview.class.php类处理   
require_once(DEDEINC."/arc.partview.class.php");   
function pasterTempletDiy2($path)   
{   
    global $cfg_basedir,$cfg_templets_skin;   
    $tmpfile = $cfg_basedir.$cfg_templets_skin."/".$path;//模版文件的路径   
    $dtp = new PartView();   
    $dtp->SetTemplet($tmpfile);   
    $dtp->Display();   
}  

对应模板用:

<?php pasterTempletDiy2("head.htm"); ?> 
<?php pasterTempletDiy2("footer.htm"); ?> 
 

{dede:php}标签循环嵌套方法:

{dede:php}  
$row = $dsql->Execute('me',"SELECT `id`,`typename`,`content` FROM dede_arctype WHERE `topid` = '上级id'"); //获取一个栏目下的分类 
while($arr = $dsql->GetArray('me')) 

  preg_match_all('#src\s*=\s*["\']?([^\s"\']*)#i', $arr['content'], $match); //栏目下分类的缩略图 :在栏目内容里设置一张图片,利用正则获取img下src的路径 
  foreach($match[1] AS $v) 
  { 
     echo '输出样式内容'; //$v是img下src的路径 
    $row1 = $dsql->Execute('me1',"SELECT `id`,`title`,`source`,`click` FROM dede_archives WHERE `typeid` =".$arr['id']); //根据获取当前$arr['id']获取文章 
 
    while($arr1 = $dsql->GetArray('me1')) 
    { 
      echo '输出样式内容' ; //$arr1文章对象 
 
    } 
    } 

{/dede:php} 

DEDE内置标签:

图片集:

{dede:arclist  addfields='piclinks字段名称'  row='读取几行' typeid=上级id channelid='模型id'} 
   <a href="#" target="_blank" class="course_[field:global.autoindex/]"><img src="[field:litpic/]"/></a> 
{/dede:arclist} 

标签内判断变量:

[field:pubdate runphp=yes] 
if(){ 
  @me = field:pubdate; //@me 就是[field:pubdate runphp=yes]里的field:pubdate 

[/field:pubdate]

[field:array runphp=yes] 
if( $GLOBALS['autoindex'] == 1){  //$GLOBALS['autoindex'] 自增1,2,3 ,用于css样式 
  @me = ''; //@me = 对象 :@me['title'] 文章标题 .@me['litpic'] 文章缩略图 
}else{ 
  @me = ''; 

[/field:array]

文章循环 -- 根据样式 $GLOBALS['autoindex']:

<!-- 文章列表 start --> 
    {dede:channelartlist typeid=121 row=6} 
    <div class="list tabs_news_{dede:global name='itemindex'/}"> 
      {dede:arclist titlelen='42' row='30' orderby='pubdate' orderway='desc'} 
          [field:array runphp=yes] 
            $sum = $GLOBALS['dsql']->GetOne("SELECT COUNT(id) as sum FROM dede_archives WHERE typeid =".@me['typeid']); 
            if($GLOBALS['autoindex']==$sum['sum'] && ($GLOBALS['autoindex'] -1) % 5 == 0){ 
              @me = '<div class="box"> 
                  <div class="img"> 
                  <a href="'.@me['arcurl'].'">  
                    <div class="play">  
                    <h6>'.@me['title'].'</h6>  
                    </div>  
                    <img src="'.@me['litpic'].'" alt="'.@me['title'].'" />  
                  </a> 
                  </div>  
                  <div class="newslist">  
                  <ul></ul></div></div></div>'; 
            }else if($GLOBALS['autoindex']==$sum['sum'] && $GLOBALS['autoindex'] % 5 == 0){ 
               @me = '<li><strong> | </strong><a href="'.@me['arcurl'].'">'.@me['title'].'</a></li></ul></div></div></div>'; 
            }else if(($GLOBALS['autoindex'] -1) % 5 == 0){ 
              @me = '<div class="box"> 
                  <div class="img"> 
                  <a href="'.@me['arcurl'].'">  
                    <div class="play">  
                    <h6>'.@me['title'].'</h6>  
                    </div>  
                    <img src="'.@me['litpic'].'" alt="'.@me['title'].'" />  
                  </a> 
                  </div>  
                  <div class="newslist">  
                  <ul>'; 
            }else if($GLOBALS['autoindex']%5 == 0){ 
              @me = '<li><strong> | </strong><a href="'.@me['arcurl'].'">'.@me['title'].'</a></li></ul></div></div>'; 
            }else{ 
              if($GLOBALS['autoindex'] == $sum['sum']){ 
                @me = '<li><strong> | </strong><a href="'.@me['arcurl'].'">'.@me['title'].'</a></li></ul></div></div></div>'; 
              }else{ 
                @me = '<li><strong> | </strong><a href="'.@me['arcurl'].'">'.@me['title'].'</a></li>'; 
              } 
            } 
          [/field:array] 
      {/dede:arclist} 
    {/dede:channelartlist} 
    <!-- 文章列表 end --> 

dede评论重写

<?php 
/**
*
* Ajax评论
*
* @version        $Id: feedback_ajax.php 1 15:38 2010年7月8日Z tianya $
* @package        DedeCMS.Site
* @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
* @license        http://help.dedecms.com/usersguide/license.html
* @link           http://www.dedecms.com
*/ 
require_once(dirname(__FILE__).'/../include/common.inc.php'); 
require_once(DEDEINC.'/channelunit.func.php'); 
AjaxHead(); 
 
if($cfg_feedback_forbid=='Y') exit('系统已经禁止评论功能!'); 
 
$aid = intval($aid); 
if(empty($aid)) exit('没指定评论文档的ID,不能进行操作!'); 
 
include_once(DEDEINC.'/memberlogin.class.php'); 
$cfg_ml = new MemberLogin(); 
 
if(empty($dopost)) $dopost = ''; 
$page = empty($page) || $page<1 ? 1 : intval($page); 
$pagesize = 10; 
 
/*----------------------
获得指定页的评论内容
function getlist(){ }
----------------------*/ 
if($dopost=='getlist') 

    $res = GetList($page); 
    $res['page'] = GetPageList($pagesize, $res['totalcount']); 
    echo json_encode($res); 
    exit(); 

/*----------------------
发送评论
function send(){ }
----------------------*/ 
else if($dopost=='send') 

    require_once(DEDEINC.'/charset.func.php'); 
 
    //检查验证码 
    if($cfg_feedback_ck=='Y') 
    { 
        $svali = strtolower(trim(GetCkVdValue())); 
        if(strtolower($validate) != $svali || $svali=='') 
        { 
            ResetVdValue(); 
            ShowMsg('验证码错误,请点击验证码图片更新验证码!','-1'); 
            exit(); 
        } 
    } 
     
    $arcRow = GetOneArchive($aid); 
    if(empty($arcRow['aid'])) 
    { 
        ShowMsg('无法查看未知文档的评论!','-1'); 
        exit(); 
    } 
    if(isset($arcRow['notpost']) && $arcRow['notpost']==1) 
    { 
        ShowMsg('这篇文档禁止评论!','-1'); 
        exit(); 
    } 
     
    if( $cfg_soft_lang != 'utf8' ) 
    { 
        $msg = UnicodeUrl2Gbk($msg); 
        if(!empty($username)) $username = UnicodeUrl2Gbk($username); 
    } 
    //词汇过滤检查 
    if( $cfg_notallowstr != '' ) 
    { 
        if(preg_match("#".$cfg_notallowstr."#i", $msg)) 
        { 
            ShowMsg("评论内容含有禁用词汇!",'-1'); 
            exit(); 
        } 
    } 
    if( $cfg_replacestr != '' ) 
    { 
        $msg = preg_replace("#".$cfg_replacestr."#i", '***', $msg); 
    } 
    if( empty($msg) ) 
    { 
        ShowMsg ("评论内容可能不合法或为空!",'-1'); 
        exit(); 
    } 
    if($cfg_feedback_guest == 'N' && $cfg_ml->M_ID < 1) 
    { 
        ShowMsg("管理员禁用了游客评论!<a href='{$cfg_cmspath}/member/login.php'>点击登录</a></font>",'-1'); 
        exit(); 
    } 
    //检查用户 
    $username = empty($username) ? '游客' : $username; 
    if(empty($notuser)) $notuser = 0; 
    if($notuser==1) 
    { 
        $username = $cfg_ml->M_ID > 0 ? '匿名' : '游客'; 
    } 
    else if($cfg_ml->M_ID > 0) 
    { 
        $username = $cfg_ml->M_UserName; 
    } 
    else if($username!='' && $pwd!='') 
    { 
        $rs = $cfg_ml->CheckUser($username, $pwd); 
        if($rs==1) 
        { 
            $dsql->ExecuteNoneQuery("Update `i_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); 
        } 
        $cfg_ml = new MemberLogin(); 
    } 
     
    //检查评论间隔时间 
    $ip = GetIP(); 
    $dtime = time(); 
    if(!empty($cfg_feedback_time)) 
    { 
        //检查最后发表评论时间,如果未登陆判断当前IP最后评论时间 
        $where = ($cfg_ml->M_ID > 0 ? "WHERE `mid` = '$cfg_ml->M_ID' " : "WHERE `ip` = '$ip' "); 
        $row = $dsql->GetOne("SELECT dtime FROM `i_feedback` $where ORDER BY `id` DESC "); 
        if(is_array($row) && $dtime - $row['dtime'] < $cfg_feedback_time) 
        { 
            ResetVdValue(); 
            ShowMsg("管理员设置了评论间隔时间,请稍等休息一下!",'-1'); 
            exit(); 
        } 
    } 
    $face = 1; 
    extract($arcRow, EXTR_SKIP); 
    $msg = cn_substrR(TrimMsg($msg), 500); 
    $username = cn_substrR(HtmlReplace($username,2), 20); 
    if(empty($feedbacktype) || ($feedbacktype!='good' && $feedbacktype!='bad')) 
    { 
        $feedbacktype = 'feedback'; 
    } 
    //保存评论内容 
    if(!empty($fid)) 
    { 
        $row = $dsql->GetOne("SELECT username,msg from `i_feedback` WHERE id ='$fid' "); 
        $qmsg = '{quote}{content}'.$row['msg'].'{/content}{title}'.$row['username'].' 的原帖:{/title}{/quote}'; 
        $msg = addslashes($qmsg).$msg; 
    } 
    $ischeck = ($cfg_feedbackcheck=='Y' ? 0 : 1); 
    $arctitle = addslashes(RemoveXSS($title)); 
    $typeid = intval($typeid); 
    $feedbacktype = preg_replace("#[^0-9a-z]#i", "", $feedbacktype); 
    $inquery = "INSERT INTO `i_feedback`(`aid`,`typeid`,`username`,`arctitle`,`ip`,`ischeck`,`dtime`, `mid`,`bad`,`good`,`ftype`,`face`,`msg`) 
                   VALUES ('$aid','$typeid','$username','$arctitle','$ip','$ischeck','$dtime', '{$cfg_ml->M_ID}','0','0','$feedbacktype','$face','$msg'); "; 
    $rs = $dsql->ExecuteNoneQuery($inquery); 
    if( !$rs ) 
    { 
        ShowMsg("发表评论出错了!",'-1'); 
        //echo $dslq->GetError(); 
        exit(); 
    } 
    $newid = $dsql->GetLastID(); 
    /*给文章评分
    if($feedbacktype=='bad')
    {
        $dsql->ExecuteNoneQuery("UPDATE `i_archives` SET scores=scores-{cfg_feedback_sub},badpost=badpost+1,lastpost='$dtime' WHERE id='$aid' ");
    }
    else if($feedbacktype=='good')
    {
        $dsql->ExecuteNoneQuery("UPDATE `i_archives` SET scores=scores+{$cfg_feedback_add},goodpost=goodpost+1,lastpost='$dtime' WHERE id='$aid' ");
    }
    else
    {
        $dsql->ExecuteNoneQuery("UPDATE `i_archives` SET scores=scores+1,lastpost='$dtime' WHERE id='$aid' ");
    }*/ 
    //给用户增加积分 
    if($cfg_ml->M_ID > 0) 
    { 
        #api{{ 
        if(defined('UC_API') && @include_once DEDEROOT.'/api/uc.func.php') 
        { 
            //同步积分 
            uc_credit_note($cfg_ml->M_LoginID, $cfg_sendfb_scores); 
             
            //推送事件 
            $arcRow = GetOneArchive($aid); 
            $feed['icon'] = 'thread'; 
            $feed['title_template'] = '<b>{username} 在网站发表了评论</b>'; 
            $feed['title_data'] = array('username' => $cfg_ml->M_UserName); 
            $feed['body_template'] = '<b>{subject}</b><br>{message}'; 
            $url = !strstr($arcRow['arcurl'],'http://') ? ($cfg_basehost.$arcRow['arcurl']) : $arcRow['arcurl'];         
            $feed['body_data'] = array('subject' => "<a href=\"".$url."\">$arcRow[arctitle]</a>", 'message' => cn_substr(strip_tags(preg_replace("/
.+?
/is", '', $msg)), 150)); 
            $feed['images'][] = array('url' => $cfg_basehost.'/images/scores.gif', 'link'=> $cfg_basehost); 
            uc_feed_note($cfg_ml->M_LoginID,$feed); unset($arcRow); 
        } 
        #/aip}} 
        $dsql->ExecuteNoneQuery("UPDATE `i_member` set scores=scores+{$cfg_sendfb_scores} WHERE mid='{$cfg_ml->M_ID}' "); 
        $row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM `i_feedback` WHERE `mid`='".$cfg_ml->M_ID."'"); 
        $dsql->ExecuteNoneQuery("UPDATE `i_member_tj` SET `feedback`='$row[nums]' WHERE `mid`='".$cfg_ml->M_ID."'"); 
    } 
    $_SESSION['sedtime'] = time(); 
    if($ischeck==0) 
    { 
        ShowMsg("成功发表评论,但需审核后才会显示你的评论!",'-1'); 
        exit(); 
    } 
    else 
    { 
        $spaceurl = '#'; 
        if($cfg_ml->M_ID > 0) $spaceurl = "{$cfg_memberurl}/index.php?uid=".urlencode($cfg_ml->M_LoginID); 
        $id = $newid; 
        $msg = stripslashes($msg); 
        $msg = str_replace('<', '<', $msg); 
        $msg = str_replace('>', '>', $msg); 
        helper('smiley'); 
        $msg = RemoveXSS(Quote_replace(parseSmileys($msg, $cfg_cmspath.'/images/smiley'))); 
        //$msg = RemoveXSS(Quote_replace($msg)); 
        if($feedbacktype=='bad') $bgimg = 'cmt-bad.gif'; 
        else if($feedbacktype=='good') $bgimg = 'cmt-good.gif'; 
        else $bgimg = 'cmt-neu.gif'; 
        global $dsql, $aid, $pagesize, $cfg_templeturl; 
        if($cfg_ml->M_ID==""){ 
             $mface=$cfg_cmspath."/member/templets/images/dfboy.png"; 
        } else { 
          $row = $dsql->GetOne("SELECT face,sex FROM `i_member` WHERE mid={$cfg_ml->M_ID} "); 
            if(empty($row['face'])) 
            { 
              if($row['sex']=="女") $mface=$cfg_cmspath."/member/templets/images/dfgirl.png"; 
              else $mface=$cfg_cmspath."/member/templets/images/dfboy.png"; 
            } 
        } 
    } 
    exit(); 

 
/**
*  读取列表内容
*
* @param     int  $page  页码
* @return    string
*/ 
function GetList($page=1) 

    global $dsql, $aid, $pagesize, $cfg_templeturl,$cfg_cmspath; 
    $querystring = "SELECT fb.*,mb.userid,mb.face as mface,mb.spacesta,mb.scores,mb.sex FROM `i_feedback` fb 
                 LEFT JOIN `i_member` mb on mb.mid = fb.mid WHERE fb.aid='$aid' AND fb.ischeck='1' ORDER BY fb.id DESC"; 
 
    $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `i_feedback` WHERE aid='$aid' AND ischeck='1' "); 
    $totalcount = (empty($row['dd']) ? 0 : $row['dd']); 
    $startNum = $pagesize * ($page-1); 
    if($startNum > $totalcount) 
    { 
        echo "参数错误!"; 
        return $totalcount; 
    } 
    $str = ''; 
    $dsql->Execute('fb', $querystring." LIMIT $startNum, $pagesize "); 
    while($fields = $dsql->GetArray('fb')){ 
        $str .= '<li>  
        <div class="clearfix"> 
         <span class="section_reply_photo"><img src="'.$fields['mface'].'" /></span>  
         <p class="f_col_DarkGray"><strong>'.$fields['username'].'</strong><span>'.date('Y-m-d H:i',$fields['dtime']).'</span></p>  
         <p class=" song "><span class="reply_time">'.$fields['msg'].'</span> </p>  
        </div>  
        </li>'; 
        
    } 
    $res['totalcount'] = $totalcount; 
    $res['msg'] = $str; 
    return $res;        

 
/**
*  获取分页列表
*
* @param     int  $pagesize  显示条数
* @param     int  $totalcount  总数
* @return    string
*/ 
function GetPageList($pagesize, $totalcount,$showNum='5') 

    global $page; 
    $curpage = empty($page) ? 1 : intval($page); 
    $allpage = ceil($totalcount / $pagesize); 
    $pagestr = ''; 
 
    if($totalcount <= 0)  
    { 
        return ''; 
    } 
    $pagestr .= '<ul>'; 
    
    //根据当前页计算前后页数 
    $leftPage_num  = ceil( $showNum / 2 ); 
    $rightPage_num = $showNum - $leftPage_num; 
 
    //左边显示数为当前页减左边该显示的数 例如总显示7页 当前页是5  左边最小为5-3  右边为5+3 
    $left  = $page - $leftPage_num; 
    $left  = $left <= 0 ? 1 : $left;    //左边最小不能小于1 
    $right = $left + $showNum - 1;      //左边加显示页数减1就是右边显示数 
    $right = $right <= $allpage ? $right : $allpage;  //右边最大不能大于总页数 
    $left  = $right - $showNum + 1 <= 0 ? 1 : $left;       //确定右边再计算左边,必须二次计算 
 
    if ($page > 1) { 
        $pagestr .= "<a href='#' onclick='LoadCommets(".($curpage-1).");'>上一页</a>"; 
    }else{ 
        $pagestr .= "<a href='#' onclick='LoadCommets(".$curpage.");'>上一页</a>"; 
    } 
 
    for ($i = $left; $i <= $right; $i++) 
    {    
        if($page == $i){ 
            $pagestr .= "<li><a href='#' class='now_page' onclick='LoadCommets(".$i.");'>".$i."</a></li>"; 
        }else{ 
            $pagestr .= "<li><a href='#' onclick='LoadCommets(".$i.");'>".$i."</a></li>"; 
        } 
    } 
 
    if ($page == $allPage) { 
        $pagestr .= "<a href='#' onclick='LoadCommets(".$allPage.");'>下一页</a>"; 
    }else{ 
        $pagestr .= "<a href='#' onclick='LoadCommets(".($curpage+1).");'>上一页</a>"; 
    } 
     
    $pagestr .= '</ul>'; 
 
    return $pagestr; 
 
}

html:

<script type="text/javascript"> 
    $(function () { 
        $pageno = "1"; 
        LoadCommets($pageno); 
    }); 
 
    //获取评论列表内容 
    function LoadCommets(pageno) { 
        aid = "{dede:field.id/}"; 
        $.post('/plus/feedback_ajax.php',{dopost:'getlist',aid:aid,page:pageno},function (res) { 
            res = JSON.parse(res);  
            $('.clink_pager').html(res.page); 
            $('.section_reply').html(res.msg); 
        }); 
    } 
 
    function changeAuthCode() { 
      var num =   new Date().getTime(); 
      var rand = Math.round(Math.random() * 10000); 
      num = num + rand; 
      $('#ver_code').css('visibility','visible'); 
      if ($("#vdimgck")[0]) { 
        $("#vdimgck")[0].src = "../include/vdimgck.php?tag=" + num; 
      } 
      return false;  
    } 
 
    //提交前检验 
    function vaildSend() { 
        if($('textarea').val().length > 200){ 
            alert("你的评论是不是太长了?请填写200字以内的评论。"); 
            return false; 
        } 
        if($('textarea').val() == ''){ 
            alert("评论内容不能为空!"); 
            return false; 
        } 
        if($("input[name='validate']").val() == ''){ 
            alert("请填写验证码!"); 
            return false; 
        } 
    } 
</script>  
 
<div class="comm">  
<!-- 发表评论 /s --> 
<div class="comm_pub clearfix">  
  <form action="/plus/feedback_ajax.php" method="post"  onsubmit="return vaildSend()">  
    <input type="hidden" name="dopost" value="send" />  
    <input type="hidden" name="comtype" value="comments" />  
    <input type="hidden" name="aid" value="{dede:field.id/}">  
    <input type="hidden" name="fid" id="feedbackfid" value="0" /> 
    <h4>评论(500):</h4>  
    <textarea name="msg" rows="4"></textarea> 
    <p class="fr"> 
        <img src="{dede:global.cfg_cmspath/}/include/vdimgck.php" id="validateimg" onclick="this.src=this.src+'?'" style="cursor: pointer;" alt="看不清?点击更换"/> 
        验证码: <input type="text" name="validate" size="4" style="text-transform:uppercase;border:solid 2px #ddd;border-radius: 3px;width: 60px;" />  
        <button >发表评论</button> 
    </p> 
  </form> 
</div> 
<!-- 发表评论 /e -->  
  
<div class="comm_list clearfix "> 
  <ul class="section_reply"> 
    <!-- 评论内容 --> 
  </ul> 
  <div class="clink_pager" data-allpage="1"> 
    <!-- 分页 --> 
  </div> 
</div> 
  
</div>  
</div>