王志广的个人分享

        王志广的个人分享 >> PHP >> 他喜欢变成他发表的文章(phpwind9.0)

他喜欢变成他发表的文章(phpwind9.0)

admin发表于2013-02-26  2,859次浏览 标签: 

如何把首页喜欢里的你关注人的喜欢,变成你关注人的发表,或许对于一个使用phpwind的新站,用你关注人的发表更符合实际意义,那么如何修改而且还要保留瀑布流,并且样式不变, 对于一个php程序原来说是一个很大的问题,下面我就简单说一下如何实现用你关注人的喜欢变成你关注人的发表。

找到src/applications/like/controller/MylikeController.php里面的dataAction方法修改成为
public function dataAction() {
$page = (int) $this->getInput(‘page’, ‘get’);
$start = (int) $this->getInput(‘start’, ‘get’);
$start >= 100 && $start = 100;
$perpage = 20;
$aaa = Wekit::load(‘attention.PwAttention’);
$follows =$aaa->getFollows($this->loginUser->uid, ‘1000’, ”);
if(1000==count($follows)){$follows =$aaa->getFollows($this->loginUser->uid, ‘10000’, ”);}
if(0==count($follows)){$this->showMessage(‘operate.success’);}
$followsall = ”;
foreach($follows as $val){$followsall[] = $val[touid];}
$jichu = Wekit::loadDao(‘forum.dao.PwThreadsIndexDao’);
$sql = “SELECT * FROM “.$jichu->getConnection()->getTablePrefix().”bbs_threads where created_userid IN

(“.implode(“,”,$followsall).”) and disabled=0 ORDER BY tid DESC LIMIT “.$start.”,”.$perpage.” “;
$sql_all = $jichu->getConnection()->query($sql);
$content = $sql_all->fetchAll(‘tid’);
$_data = “”;
$a = “”;
foreach($content as $val){$a[] =$val[tid]; }
$images = Wekit::load(‘like.srv.PwBuildLikeService’)->_getDataFromThread($a);
foreach($content as $key=>$val){
$_data[$key][‘fromid’] = $val[‘tid’];
$_data[$key][‘fromtype’] = $val[‘fid’];
$_data[$key][‘url’] = $images[$key][‘url’];
$_data[$key][‘image’] = $images[$key][‘image’];
$_data[$key][‘subject’] = $val[‘subject’];
$_data[$key][‘descrip’] = $images[$key][‘content’];
$_data[$key][‘uid’] = $val[‘created_userid’];
$_data[$key][‘username’] = $val[‘created_username’];
$_data[$key][‘avatar’] = Pw::getAvatar($val[‘created_userid’], ‘small’);
$_data[$key][‘space’] = WindUrlHelper::createUrl(
‘space/index/run/?uid=’ . $val[‘created_userid’]);
$_data[$key][‘lasttime’] = date(“m-d”,$val[‘created_time’]);
$_data[$key][‘like_count’] = $val[‘like_count’];
$_data[$key][‘reply_content’] =  $val[‘replies’];
}
$this->setOutput($_data, ‘data’);
$this->showMessage(‘operate.success’);
}

并把Wekit::load(‘like.srv.PwBuildLikeService’)->_getDataFromThread();变为公共函数就可以了。就可以显示你关注人的发表

你可以发表评论引用到你的网站或博客,或通过RSS 2.0订阅这个日志的所有评论。
上一篇:
下一篇:
没有评论
我来说两句

  Ctrl+Enter