Typecho通过判断用户登陆状态,给文章加编辑按钮
时间:2020-08-01 阅读:432
在Typecho中有些内容是希望登陆之后才可见,例如文章的编辑链接,可以用下面的方法实现。
文章编辑代码如下:
<?php if($this->user->hasLogin()):?> <a href="<?php $this->options->adminUrl(); ?>write-post.php?cid=<?php echo $this->cid;?>">编辑</a> <?php endif;?>
独立页面编辑代码如下:
<?php if($this->user->hasLogin()):?> <a href="<?php $this->options->adminUrl(); ?>write-page.php?cid=<?php echo $this->cid;?>" >编辑</a> <?php endif;?>
网友评论