织梦文章设置会员登录才能访问

一、织梦文章要会员才可以浏览,则需设置文章动态

二、织梦系统基本参数开启会员功能。

三、/include/arc.archives.class.php修改

   /**

     *  php5构造函数

     *

     * @access    public

     * @param     int  $aid  文档ID

     * @return    string

     */

前添加

var $MemberLogin;

//End foreach

后面加

global $cfg_ckbodyopen,$cfg_ckbodynum; 
   $this->Fields['$cfg_ckbodyopen']  = (empty($cfg_ckbodyopen) ? "Y" : "$cfg_ckbodyopen" ); 
   $this->Fields['$cfg_ckbodynum']  = (empty($cfg_ckbodynum) ? "500" : "$cfg_ckbodynum" );
   if(($this->Fields['$cfg_ckbodyopen'] == "Y" || $this->Fields['$cfg_ckbodyopen'] == "y") && $this->Fields['ismake']==-1){
    require_once(DEDEINC.'/memberlogin.class.php');
    $this->MemberLogin = new MemberLogin();
    $this->Fields['ckbodyhtml'] = " <br /> 
    <div class='ckbodyhtml' style='width:80%;margin-left:10%;margin-top:30px;float:left;border:1px solid #000;background:#dedede;text-align:center;'> 你没有登陆,无法阅读全文内容,点击此处登陆 </div>";
if($this->MemberLogin->IsLogin()){ 
     $this->Fields['ckbody'] = $this->Fields['body'];
     //已经登陆
    }else{
     $this->Fields['ckbody'] = cn_substr(Html2Text($this->Fields['body']),$this->Fields['$cfg_ckbodynum']);
     $this->Fields['ckbody'] .= $this->Fields['ckbodyhtml'];
     //未登陆
    }
   }else{
    $this->Fields['ckbody'] = $this->Fields['body'];
    }


文章中内容body调用

{dede:field.ckbody/}