方维分享系统模板修改,二次开发,个人中心杂志社显示我的、关注的、推荐的数量,这样对用户体验甚好;
实现类似上图的效果,在u.module.php 1179行加入以下代码
//add by wangtongphp QQ:1006440989 获取用户的、关注的、推荐的收纳盒的数量 //我关注的数量 $sql = 'SELECT uid FROM '.FDB::table('user_follow').' WHERE f_uid = '.$home_uid; $res = FDB::query($sql); while($data = FDB::fetch($res)) { $uids[] = (int)$data['uid']; } if(count($uids) > 0) { $sql = 'SELECT COUNT(id) FROM '.FDB::table("album").' WHERE uid IN ('.implode(',',$uids).')'; $home_user['album_follow_count'] = FDB::resultFirst($sql); } //我推荐的数量 $sql = 'SELECT album_id FROM '.FDB::table('album_best').' WHERE uid = '.$home_uid; $res = FDB::query($sql); while($data = FDB::fetch($res)) { $aids[] = (int)$data['album_id']; } if(count($aids) > 0) { $sql = 'SELECT COUNT(id) FROM '.FDB::table("album").' WHERE id IN ('.implode(',',$aids).')'; $home_user['album_attention_count'] = FDB::resultFirst($sql); }
转载请注明来源:http://www.cnblogs.com/wangtongphp/archive/2013/05/16/3081109.html ,有需求请联系博主QQ:1006440989
在模板中,分别以$home_user['albums'],$home_user['album_follow_count'],$home_user['album_attention_count'] 调用我的杂志社数量、我关注的用户的杂志社数量、我推荐的杂志社数量;