方维分享系统模板修改,book_share_list.htm调用用户数据,$_FANWE['user']的数据

要实现这样的效果, 

book_share_list.htm是以下四个的公共页面

要是调用当前模块的数量,就可以用count($share_list);

如果想仿知美,那就可以用方维全局的变量了$_FANWE['user'];

以下是$_FANWE['user']的数据

array(65) {
  ["uid"]=>
  string(1) "1"
  ["gid"]=>
  string(1) "7"
  ["email"]=>
  string(17) "1006440989@qq.com"
  ["user_name"]=>
  string(11) "wangtongphp"
  ["password"]=>
  string(32) "f59b6e10071asfaefef2b48466d0e"
  ["money"]=>
  string(4) "0.00"
  ["credits"]=>
  string(2) "62"
  ["reg_time"]=>
  string(10) "1367603232"
  ["status"]=>
  string(1) "1"
  ["email_status"]=>
  string(1) "0"
  ["avatar"]=>
  string(1) "0"
  ["is_daren"]=>
  string(1) "0"
  ["ucenter_id"]=>
  string(1) "0"
  ["invite_id"]=>
  string(1) "0"
  ["is_buyer"]=>
  string(1) "0"
  ["buyer_level"]=>
  string(1) "0"
  ["seller_level"]=>
  string(1) "0"
  ["server_code"]=>
  string(0) ""
  ["active_sn"]=>
  string(0) ""
  ["follows"]=>
  string(1) "0"
  ["fans"]=>
  string(1) "0"
  ["collects"]=>
  string(1) "0"
  ["favs"]=>
  string(1) "0"
  ["threads"]=>
  string(1) "4"
  ["photos"]=>
  string(1) "2"
  ["goods"]=>
  string(1) "1"
  ["shares"]=>
  string(2) "12"
  ["forums"]=>
  string(1) "4"
  ["forum_posts"]=>
  string(1) "0"
  ["albums"]=>
  string(1) "2"
  ["referrals"]=>
  string(1) "0"
  ["looks"]=>
  string(1) "0"
  ["dapei"]=>
  string(1) "0"
  ["groups"]=>
  string(1) "1"
  ["events"]=>
  string(1) "0"
  ["activity"]=>
  string(1) "2"
  ["activity_post"]=>
  string(1) "0"
  ["vote"]=>
  string(1) "0"
  ["vote_post"]=>
  string(1) "0"
  ["trial"]=>
  string(1) "0"
  ["trial_post"]=>
  string(1) "0"
  ["reg_ip"]=>
  string(9) "127.0.0.1"
  ["last_ip"]=>
  string(9) "127.0.0.1"
  ["last_time"]=>
  string(10) "1367603232"
  ["last_activity"]=>
  string(10) "1367603232"
  ["active_hash"]=>
  string(0) ""
  ["reset_hash"]=>
  string(0) ""
  ["edit_name_count"]=>
  string(1) "0"
  ["black_users"]=>
  NULL
  ["medals"]=>
  string(1) "1"
  ["last_share"]=>
  string(2) "20"
  ["nick_name"]=>
  string(0) ""
  ["gender"]=>
  string(1) "0"
  ["birth_year"]=>
  string(1) "0"
  ["birth_month"]=>
  string(1) "0"
  ["birth_day"]=>
  string(1) "0"
  ["reside_province"]=>
  string(1) "1"
  ["reside_city"]=>
  string(2) "36"
  ["school"]=>
  string(0) ""
  ["workplace"]=>
  string(0) ""
  ["occupation"]=>
  string(1) "0"
  ["weibo"]=>
  string(31) "http://wangtongphp.cnblogs.com/"
  ["hobby"]=>
  string(0) ""
  ["introduce"]=>
  string(21) "我是一只小小鸟"
  ["last_visit"]=>
  string(10) "1367599423"
}

举例调用数据:

宝贝\<?php echo $_FANWE['user']['goods']; ?>
晒货\<?php echo $_FANWE['user']['looks']; ?>
搭配\<?php echo $_FANWE['user']['dapei']; ?>
相册\<?php echo $_FANWE['user']['photos']; ?>

这上面调用的登陆用户自己的数据,如果访问其他用户的空间,还是这个数据,所以,此方案行不通

 ****************************************************************************************************************

 再次研究u.module.php,有这样一句

$args = array('share_list'=>&$share_list,'pager'=>&$pager,'pb_url'=>&$pb_url,'pb_list'=>&$pb_list,'book_type'=>'goods','home_user'=>&$home_user);

这就是为何在u.module.php中能打印出home_user的值,在book_share_list.htm中却没有;

解决方法:批量替换这个文件

$args = array('share_list'=>&$share_list,'pager'=>&$pager,'pb_url'=>&$pb_url,'pb_list'=>&$pb_list,

$args = array('share_list'=>&$share_list,'home_user'=>&$home_user,'pager'=>&$pager,'pb_url'=>&$pb_url,'pb_list'=>&$pb_list,

一共有五个地方被替换,也就是说book_share_list.htm是五个模块的公用模板

这样就对了

<a href="{u u/bao uid=$home_user['uid']}">宝贝\<?php echo $home_user['goods']; ?></a>
晒货\<?php echo $home_user['looks']; ?>
搭配和<?php echo $home_user['dapei']; ?>
相册<?php echo $home_user['photos']; ?>

原文地址:https://www.cnblogs.com/wangtongphp/p/3065840.html