Emlog非插件实现登录隐藏内容

时间:2020-08-01   阅读:267

教程演示

 Emlog非插件实现登录隐藏内容 文章

教程简介

Emlog非安装插件来实现隐藏内容登录查看 这次教程 加代码 加代码 加代码 什么是登录查看隐藏内容?必须你在本站注册并登录上 才可查看文章隐藏内容 没登录 代表的就是游客 无法查看隐藏内容的 带有邀请码的注册 可以用这个来赚点红牛钱啥的 不废话了 

第一步

module.php核心文件添加以下代码
//登录查看隐藏内容      
function slyc($content){  
    if(preg_match_all('/<yc\>([\s\S]*?)<\/yc\>/i', $content, $hide_words)){  
        if(ISLOGIN ){  
            $content = str_replace($hide_words[0], $hide_words[1], $content);  
        }else{  
            $hide_notice = '<div style="text-align:center;border:1px dashed #19b5fe;padding:8px;margin:10px auto;color:#2196f3;">您必须先<a href="'.BLOG_URL.'admin">登录</a>才能查看隐藏内容</div>';  
            $content = str_replace($hide_words[0], $hide_notice, $content);  
        }  
    }  
    return $content;  
}

第二步

echo_log.php文件中找到代码:

<?php echo $log_content; ?>

替换为

<?php echo slyc($log_content); ?>

如何隐藏

编辑文章的时候 切换到HTML模式 在要隐藏的地方放上隐藏代码

<yc> 此处是要隐藏的内容 </yc>


上一篇:Emlog增加弹出搜索功能教程

下一篇:Emlog非插件实现3D标签云

网友评论