Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

★省★市★地区◆三级联动◆(1.5正式版) 可扩展!

[复制链接]
whj888 发表于 2008-12-13 14:05:45 | 显示全部楼层 |阅读模式
本帖最后由 whj888 于 2009-3-27 21:08 编辑

省市县三级联动插件   UCH1.5正式版
首先感谢 zsycnc 提供的UCH1.2省市县三级联动插件修改。
原帖地址:https://discuz.dismall.com/viewthread ... %C1%AA%B6%AF&page=1
与学校信息UCH1.5正式版 https://discuz.dismall.com/thread-1144984-1-1.html 可以一起使用,互不冲突。
需要地区性的三级联动,可以在此基础上修改JS文件即可。
主要改进:
1、用户在设置地址信息后,打开个人资料页可自动显示。
2、修正了我已知的地址错误信息。(js文件更新于2006年,由于时间关系不能一一检查,希望有高手把JS地址批量更新到最新,原来在论坛看到有一位朋友进行过更新工作,可惜我找不到了,若哪位朋友能找到最新的JS请告之)

改动较多,请先备份相关文件。看不明白修改方法的可看6楼的非code版,红色字为改动部分。附件还提供了修改过的文件,如果相关文件你没有修改过可直接覆盖。最后还提供了学校信息和省市区三级联动的共同文件。(建议手工修改!实在改不了的,备份后覆盖试试。)

修改方法:
一、增加数据字段:
用phpmyadmin在uhome数据库的“uchome_spacefield”表里面添加两个字段:
birthsubcity和residesubcity,类型:varchar(20)
SQL语句:   
ALTER TABLE `uchome_spacefield` ADD `birthsubcity` VARCHAR( 20 ) NOT NULL AFTER `birthcity` ;
ALTER TABLE `uchome_spacefield` ADD `residesubcity` VARCHAR( 20 ) NOT NULL AFTER `residecity` ;
二、修改文件:(三个模板文件,三个程序文件)
1、修改cp_profile.htm
  1.              <th>家乡</th>
  2.             <td>               
  3. <script language="javascript" src="source/pcasunzip.js"></script>
  4. <select name="birthprovince"  >
  5. </select>
  6. <select name="birthcity" >
  7. </select>
  8. <select name="birthsubcity" >
  9. </select>
  10. <script language="javascript" defer="defer">
  11. <!--
  12. new PCAS("birthprovince","birthcity","birthsubcity","$space[birthprovince]","$space[birthcity]","$space[birthsubcity]");
  13. //-->
  14. </script>
  15.             </td>
  16.         </tr>
  17.         <tr>
  18.             <th>居住地</th>
  19.             <td>
  20.             <select name="resideprovince">
  21. </select>
  22. <select name="residecity" tabindex="123">
  23. </select>
  24. <select name="residesubcity" >
  25. </select>
  26.                 <script type="text/javascript" defer="defer">
  27.                 <!--
  28.              new PCAS("resideprovince","residecity","residesubcity","$space[resideprovince]","$space[residecity]","$space[residesubcity]");
  29.                 //-->
  30.                 </script>
  31.               
  32.             </td>
  33.         </tr>
复制代码
2、修改 cp_friend.htm
  1. <th>家乡</th>
  2.             <td>               
  3. <script language="javascript" src="source/pcasunzip.js"></script>
  4. <select name="birthprovince"></select><select name="birthcity" ></select><select name="birthsubcity" ></select>
  5. <script language="javascript" defer="defer">
  6. new PCAS("birthprovince","birthcity","birthsubcity");
  7. </script>

  8.             </td>
  9.         </tr>
  10.         <tr>
  11.             <th>居住地</th>
  12.             <td>
  13.             <select name="resideprovince"></select><select name="residecity" tabindex="123"></select><select name="residesubcity" ></select>
  14.                 <script type="text/javascript" defer="defer">
  15.                 <!--
  16.              new PCAS("resideprovince","residecity","residesubcity");
  17.                 //-->
  18.                 </script>
  19.               
  20.             </td>
  21.         </tr>
复制代码
3、修改 network_space.htm
  1. <th>家乡</th>
  2.             <td>               
  3. <script language="javascript" src="source/pcasunzip.js"></script>
  4. <select name="birthprovince"></select><select name="birthcity" ></select><select name="birthsubcity" ></select>
  5. <script language="javascript" defer="defer">
  6. new PCAS("birthprovince","birthcity","birthsubcity");
  7. </script>

  8.             </td>
  9.         </tr>
  10.         <tr>
  11.             <th>居住地</th>
  12.             <td>
  13.             <select name="resideprovince"></select><select name="residecity" tabindex="123"></select><select name="residesubcity" ></select>
  14.                 <script type="text/javascript" defer="defer">
  15.                 <!--
  16.              new PCAS("resideprovince","residecity","residesubcity");
  17.                 //-->
  18.                 </script>
  19.               
  20.             </td>
  21.         </tr>


复制代码
4、修改source/space_index.php
  1. //个人资料
  2. //性别

  3. $space['birth'] = trim(($space['birthprovince']?"<a href="network.php?ac=space&birthprovince=".rawurlencode($space['birthprovince'])."&searchmode=1">$space[birthprovince]</a>":'').($space['birthcity']?" <a href="network.php?ac=space&birthcity=".rawurlencode($space['birthcity'])."&searchmode=1">$space[birthcity]</a>":'').($space['birthsubcity']?" <a href="network.php?ac=space&birthsubcity=".rawurlencode($space['birthsubcity'])."&searchmode=1">$space[birthsubcity]</a>":''));
  4.     $space['reside'] = trim(($space['resideprovince']?"<a href="network.php?ac=space&resideprovince=".rawurlencode($space['resideprovince'])."&searchmode=1">$space[resideprovince]</a>":'').($space['residecity']?" <a href="network.php?ac=space&residecity=".rawurlencode($space['residecity'])."&searchmode=1">$space[residecity]</a>":'').($space['residesubcity']?" <a href="network.php?ac=space&residesubcity=".rawurlencode($space['residesubcity'])."&searchmode=1">$space[residesubcity]</a>":''));
复制代码
5、修改 source/network_space.php
  1. //开始搜索

  2.         $wherearr = array();
  3.         foreach (array('sex', 'birthyear', 'birthmonth', 'birthday', 'marry', 'blood', 'birthprovince', 'birthcity','birthsubcity', 'resideprovince', 'residecity','residesubcity', 'qq', 'msn') as $value)

  4. //判断是否搜索太快
  5. $gets['birthprovince'] = empty($_GET['birthprovince'])?'':stripsearchkey($_GET['birthprovince']);
  6.         $gets['birthcity'] = empty($_GET['birthcity'])?'':stripsearchkey($_GET['birthcity']);
  7.        $gets['birthsubcity'] = empty($_GET['birthsubcity'])?'':stripsearchkey($_GET['birthsubcity']);
  8.         $gets['resideprovince'] = empty($_GET['resideprovince'])?'':stripsearchkey($_GET['resideprovince']);
  9.         $gets['residecity'] = empty($_GET['residecity'])?'':stripsearchkey($_GET['residecity']);
  10.        $gets['residesubcity'] = empty($_GET['residesubcity'])?'':stripsearchkey($_GET['residesubcity']);
复制代码
6、修改source/cp_profile.php
  1. //提交检查
  2. //增加下面的(放在最后,注意最后一个没有逗号)
  3. 'birthsubcity' => getstr($_POST['birthsubcity'], 20, 1, 1),
  4. 'residesubcity' => getstr($_POST['residesubcity'], 20, 1, 1)
复制代码
三、上传JS文件:
把附件 pcasunzip.rar 中JS文件解压,上传到source文件夹中。

我把修改过程的文本文件一起上传了,可参照文本文件进行修改。修改地方比较多,请认真对照原来的代码修改.

评分

2

查看全部评分

cqnight 发表于 2008-12-13 14:09:21 | 显示全部楼层
有演示吗?
回复

使用道具 举报

songsong20 发表于 2008-12-13 14:12:53 | 显示全部楼层
支持下  
回复

使用道具 举报

coobii 发表于 2008-12-13 14:14:22 | 显示全部楼层
太棒了。终于等到了。
回复

使用道具 举报

俊客 发表于 2008-12-13 14:16:08 | 显示全部楼层
不错

回复

使用道具 举报

 楼主| whj888 发表于 2008-12-13 14:17:40 | 显示全部楼层
本帖最后由 whj888 于 2008-12-23 13:03 编辑

省市县三级联动插件   UCH1.5正式版
首先感谢 zsycnc 提供的UCH1.2省市县三级联动插件修改。
原帖地址:https://discuz.dismall.com/viewthread ... %C1%AA%B6%AF&page=1
与学校信息UCH1.5正式版 https://discuz.dismall.com/thread-1144984-1-1.html 可以一起使用,互不冲突。
需要地区性的三级联动,可以在此基础上修改JS文件即可。
主要改进:
1、用户在设置地址信息后,打开个人资料页可自动显示。
2、修正了我已知的地址错误信息。(js文件更新于2006年,由于时间关系不能一一检查,希望有高手把JS地址批量更新到最新,原来在论坛看到有一位朋友进行过更新工作,可惜我找不到了,若哪位朋友能找到最新的JS请告之)

改动较多,请先备份相关文件。

修改方法:
一、增加数据字段:
用phpmyadmin在uhome数据库的“uchome_spacefield”表里面添加两个字段:
birthsubcity和residesubcity,类型:varchar(20)
SQL语句:   
ALTER TABLE `uchome_spacefield` ADD `birthsubcity` VARCHAR( 20 ) NOT NULL AFTER `birthcity` ;
ALTER TABLE `uchome_spacefield` ADD `residesubcity` VARCHAR( 20 ) NOT NULL AFTER `residecity` ;
二、修改文件:(三个模板文件,三个程序文件)
1、修改cp_profile.htm

                                  <th>家乡</th>
            <td>               
<script language="javascript" src="source/pcasunzip.js"></script>
<select name="birthprovince"  >
</select>
<select name="birthcity" >
</select>
<select name="birthsubcity" >
</select>
<script language="javascript" defer="defer">
<!--
new PCAS("birthprovince","birthcity","birthsubcity","$space[birthprovince]","$space[birthcity]","$space[birthsubcity]");
//-->
</script>
            </td>
        </tr>
        <tr>
            <th>居住地</th>
            <td>
           <select name="resideprovince">
</select>
<select name="residecity" tabindex="123">
</select>
<select name="residesubcity" >
</select>
                <script type="text/javascript" defer="defer">
                <!--
             new PCAS("resideprovince","residecity","residesubcity","$space[resideprovince]","$space[residecity]","$space[residesubcity]");
                //-->
                </script>
              
            </td>
        </tr>
   
                  2、修改 cp_friend.htm

                     <th>家乡</th>
            <td>               
<script language="javascript" src="source/pcasunzip.js"></script>
<select name="birthprovince"></select><select name="birthcity" ></select><select name="birthsubcity" ></select>
<script language="javascript" defer="defer">
new PCAS("birthprovince","birthcity","birthsubcity");
</script>

            </td>
        </tr>
        <tr>
            <th>居住地</th>
            <td>
            <select name="resideprovince"></select><select name="residecity" tabindex="123"></select><select name="residesubcity" ></select>
                <script type="text/javascript" defer="defer">
                <!--
             new PCAS("resideprovince","residecity","residesubcity");
                //-->
                </script>
              
            </td>
        </tr>

                    3、修改 netword_space.htm
                    <th>家乡</th>
            <td>               
<script language="javascript" src="source/pcasunzip.js"></script>
<select name="birthprovince"></select><select name="birthcity" ></select><select name="birthsubcity" ></select>
<script language="javascript" defer="defer">
new PCAS("birthprovince","birthcity","birthsubcity");
</script>

            </td>
        </tr>
        <tr>
            <th>居住地</th>
            <td>
            <select name="resideprovince"></select><select name="residecity" tabindex="123"></select><select name="residesubcity" ></select>
                <script type="text/javascript" defer="defer">
                <!--
             new PCAS("resideprovince","residecity","residesubcity");
                //-->
                </script>
              
            </td>
        </tr>



                     4、修改source/space_index.php

//个人资料
//性别

$space['birth'] = trim(($space['birthprovince']?"<a href=\"network.php?ac=space&birthprovince=".rawurlencode($space['birthprovince'])."&searchmode=1\">$space[birthprovince]</a>":'').($space['birthcity']?" <a href=\"network.php?ac=space&birthcity=".rawurlencode($space['birthcity'])."&searchmode=1\">$space[birthcity]</a>":'').($space['birthsubcity']?" <a href=\"network.php?ac=space&birthsubcity=".rawurlencode($space['birthsubcity'])."&searchmode=1\">$space[birthsubcity]</a>":''));
    $space['reside'] = trim(($space['resideprovince']?"<a href=\"network.php?ac=space&resideprovince=".rawurlencode($space['resideprovince'])."&searchmode=1\">$space[resideprovince]</a>":'').($space['residecity']?" <a href=\"network.php?ac=space&residecity=".rawurlencode($space['residecity'])."&searchmode=1\">$space[residecity]</a>":'').($space['residesubcity']?" <a href=\"network.php?ac=space&residesubcity=".rawurlencode($space['residesubcity'])."&searchmode=1\">$space[residesubcity]</a>":''));


                   5、修改 source/network_space.php

//开始搜索

        $wherearr = array();
        foreach (array('sex', 'birthyear', 'birthmonth', 'birthday', 'marry', 'blood', 'birthprovince', 'birthcity','birthsubcity', 'resideprovince', 'residecity','residesubcity', 'qq', 'msn') as $value)

//判断是否搜索太快
$gets['birthprovince'] = empty($_GET['birthprovince'])?'':stripsearchkey($_GET['birthprovince']);
        $gets['birthcity'] = empty($_GET['birthcity'])?'':stripsearchkey($_GET['birthcity']);
       $gets['birthsubcity'] = empty($_GET['birthsubcity'])?'':stripsearchkey($_GET['birthsubcity']);
        $gets['resideprovince'] = empty($_GET['resideprovince'])?'':stripsearchkey($_GET['resideprovince']);
        $gets['residecity'] = empty($_GET['residecity'])?'':stripsearchkey($_GET['residecity']);
       $gets['residesubcity'] = empty($_GET['residesubcity'])?'':stripsearchkey($_GET['residesubcity']);

                  6、修改source/cp_profile.php
//提交检查
//增加下面的(放在最后,注意最后一个没有逗号)
'birthsubcity' => getstr($_POST['birthsubcity'], 20, 1, 1),
'residesubcity' => getstr($_POST['residesubcity'], 20, 1, 1)

                     三、上传JS文件:
把附件 pcasunzip.rar 中JS文件解压,上传到source文件夹中。

红字部分是有改动的地方,修改地方比较多,请认真对照原来的代码修改.
回复

使用道具 举报

super81 发表于 2008-12-13 17:48:59 | 显示全部楼层
mark备用~
回复

使用道具 举报

1753103 发表于 2008-12-13 17:53:10 | 显示全部楼层
很爱很爱你 所以愿意 第一个装起
回复

使用道具 举报

窝窝.com 发表于 2008-12-13 18:05:10 | 显示全部楼层
狂顶楼主。。。。。。。。。。。。。。。。。。。。。。
回复

使用道具 举报

1753103 发表于 2008-12-13 18:10:43 | 显示全部楼层
  安装 成功!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-21 15:25 , Processed in 0.425367 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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