Discuz教程网

[代码修改] 出生地增加第三级县市和第四级乡镇 for discuz x 1.5

[复制链接]
authicon dly 发表于 2011-4-26 07:55:05 | 显示全部楼层 |阅读模式
修改两个文件:
source/include/spacecp/space_profile.php
source/function/function_profile.php
升级两条SQL:


  1. ALTER TABLE `pre_common_member_profile` ADD `birthdist` VARCHAR( 255 ) NOT NULL AFTER `birthcity` ;
  2. ALTER TABLE `pre_common_member_profile` ADD `birthcommunity` VARCHAR( 255 ) NOT NULL AFTER `birthdist` ;
复制代码



修改方法:
一、打开space_profile.php文件,
查找:

  1. if($setarr) {

  2. DB::update('common_member_profile', $setarr, array('uid'=>$_G['uid']));

  3. }

复制代码



上面加:
  1. //start

  2. if(isset($_POST['birthdist'])) {

  3. $setarr['birthdist'] = trim($_POST['birthdist']);

  4. }

  5. if(isset($_POST['birthcommunity'])) {

  6. $setarr['birthcommunity'] = trim($_POST['birthcommunity']);

  7. }

  8. //end

复制代码



二、打开function_profile.php文件:
1.查找:
  1. if($field['unchangeable'] && !empty($space[$fieldid])) {

  2. return '<SPAN>'.$space['birthprovince'].'-'.$space['birthcity'].'</SPAN>';

  3. }

  4. $values = array(0, 0);

  5. $elems = array('birthprovince', 'birthcity');

  6. if(!empty($space['birthprovince'])) {

  7. $html = profile_show('birthcity', $space);

  8. $html .= ' <A onclick="showdistrict(\'birthdistrictbox\', [\'birthprovince\', \'birthcity\'], 2); return false;" href="javascript:;">'.lang('spacecp', 'profile_edit').'</A>';

  9. $html .= '

  10. <P id=birthdistrictbox>



  11. ';

  12. } else {

  13. $html = '

  14. <P id=birthdistrictbox>'.showdistrict($values, $elems, 'birthdistrictbox').'



  15. ';

  16. }

  17. </P>

复制代码

替换为:
  1. if($field['unchangeable'] && !empty($space[$fieldid])) {

  2. return '<SPAN>'.$space['birthprovince'].'-'.$space['birthcity'].'</SPAN>';

  3. }

  4. $values = array(0,0,0,0);

  5. $elems = array('birthprovince', 'birthcity', 'birthdist', 'birthcommunity');

  6. if(!empty($space['birthprovince'])) {

  7. $html = profile_show('birthcity', $space);

  8. $html .= ' <A onclick="showdistrict(\'birthdistrictbox\', [\'birthprovince\', \'birthcity\', \'birthdist\', \'birthcommunity\'], 4); return false;" href="javascript:;">'.lang('spacecp', 'profile_edit').'</A>';

  9. $html .= '

  10. <P id=birthdistrictbox>



  11. ';

  12. } else {

  13. $html = '

  14. <P id=birthdistrictbox>'.showdistrict($values, $elems, 'birthdistrictbox').'



  15. ';

  16. }

  17. </P>

复制代码


2.查找:
  1. return $space['birthprovince'].' '.$space['birthcity'];

复制代码


替换为:
  1. return $space['birthprovince']

  2. .(!empty($space['birthcity']) ? ' '.$space['birthcity'] : '')

  3. .(!empty($space['birthdist']) ? ' '.$space['birthdist'] : '')

  4. .(!empty($space['birthcommunity']) ? ' '.$space['birthcommunity'] : '');

复制代码






上一篇:用SESSION实现Discuz X多国语言
下一篇:Discuz X 模板中添加可拖拽区域
authicon a137580399 发表于 2011-4-29 09:01:29 | 显示全部楼层
学习了~~~~~
authicon 蓝天blue 发表于 2011-5-6 17:18:08 | 显示全部楼层
这个不错呀
authicon fantuanzi 发表于 2011-5-6 17:38:08 | 显示全部楼层
这个还是不错的!
authicon 蓝天blue 发表于 2011-5-6 17:39:25 | 显示全部楼层
好像不错的样子
authicon melody0721 发表于 2011-5-6 17:59:39 | 显示全部楼层
好东东下下来看看
authicon lilac_yao 发表于 2011-5-6 18:59:36 | 显示全部楼层
谢谢,学习了
authicon 纤陌陌 发表于 2011-5-7 04:59:52 | 显示全部楼层
这个贴不错!!!
authicon 乐娃娃 发表于 2011-5-9 04:59:47 | 显示全部楼层
喜欢喜欢喜欢
authicon 蓝天blue 发表于 2011-5-10 06:59:58 | 显示全部楼层
顶的就是你
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 18:24

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表