加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > Dedecms > 正文

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

发布时间:2020-12-14 04:20:33 所属栏目:Dedecms 来源:网络整理
导读:一、织梦文章要会员才可以浏览,则需设置文章为动态。 二、织梦系统基本参数开启会员功能。 三、/include/arc.archives.class.php修改 在 ? ?/** ? ? ?*? php5构造函数 ? ? ?* ? ? ?* @access? ? public ? ? ?* @param? ? ?int? $aid? 文档ID ? ? ?* @return

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

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

三、/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/}?

上一篇:织梦百度小程序微信小程序video标签不支持视频封面,autoplay等问题修复方法

下一篇:织梦pagebreak文章分页显示设置

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读