post.php
找到
<?php $this->content(); ?>
替换为
<?php
$db = Typecho_Db::get();
$sql = $db->select()->from('table.comments')
->where('cid = ?',$this->cid)
->where('mail = ?', $this->remember('mail',true))
->limit(1);
$result = $db->fetchAll($sql);
if($this->user->hasLogin() || $result) {
$content = preg_replace("/\[reply\](.*?)\[\/reply\]/sm",'<div class="reply2view"><i class="icon-lock-open"></i>$1</div>',$this->content);
}
else{
$content = preg_replace("/\[reply\](.*?)\[\/reply\]/sm",'<div class="reply2view"><i class="icon-lock"></i><strong><span style="color: #800000;">温馨提示</span></strong>:此处为隐藏内容,评论回复后方可阅读。</div>',$this->content);
}
echo $content
?>
$db = Typecho_Db::get();
$sql = $db->select()->from('table.comments')
->where('cid = ?',$this->cid)
->where('mail = ?', $this->remember('mail',true))
->limit(1);
$result = $db->fetchAll($sql);
if($this->user->hasLogin() || $result) {
$content = preg_replace("/\[reply\](.*?)\[\/reply\]/sm",'<div class="reply2view"><i class="icon-lock-open"></i>$1</div>',$this->content);
}
else{
$content = preg_replace("/\[reply\](.*?)\[\/reply\]/sm",'<div class="reply2view"><i class="icon-lock"></i><strong><span style="color: #800000;">温馨提示</span></strong>:此处为隐藏内容,评论回复后方可阅读。</div>',$this->content);
}
echo $content
?>
使用方法
[reply]需要隐藏的内容部分丢到这里[/reply]
更复杂的效果百度吧!
打赏作者,期待美好
打赏鼓励作者,为网友提供更多更好的测试,也许一瓶水就够了。