typecho的author.php文件
是用户页面,但是官网给予的参考文档很少,很多人也是直接忽略掉了这个页面
我也是通过打印$this
获取了我们大概能调用,有用的东西
例如:获取当前用户的信息
$userInfo = (object)$this->pageRow;
print_r($userInfo->screenName);
具体可调用参数,可打印print_r($userInfo)来查看
输出该作者的文章,这里跟列表页面一样的
至于为什么?
archive.php 通用(分类、搜索、标签、作者)页面文件
可以看结构,这四个页面能调用的东西都大致相同
have()): ?> next()): ?> 内容 空空如也~
输出这个人的评论
需要在functions.php添加代码
/*输出作者发表的评论*/
class Widget_Post_AuthorComment extends Widget_Abstract_Comments
{
var $getAuthorUid;
public function execute()
{
global $AuthorCommentId;//全局作者id
$select = $this->select()->limit($this->parameter->pageSize)
->where('table.comments.status = ?', 'approved')
->where('table.comments.authorId = ?',$this->parameter->authorId)//获取作者id
->where('table.comments.type = ?', 'comment')
->order('table.comments.coid', Typecho_Db::SORT_DESC);//根据coid排序
$this->db->fetchAll($select, array($this, 'push'));
}
}
然后再author.php可以调用
widget('Widget_Post_AuthorComment@author','pageSize=8&authorId=用户id')->to($AuthorComment); ?>have()): ?> next()): ?> //循环处
//可调用参数
//$AuthorComment->permalink(); 该评论所属文章链接
//$AuthorComment->title();该评论所属文章标题
//$AuthorComment->content();该评论内容
//$AuthorComment->dateWord();该评论时间 看起来这里没有任何东西。
尚待补充...
来源:https://wiki.owoii.com/archives/27.html
!
发表评论