Home >Backend Development >PHP Tutorial >uchome群组改无限分类

uchome群组改无限分类

WBOY
WBOYOriginal
2016-06-23 14:14:411104browse

php,uchome

UChome中把群组改为无限级分类,根据文档,要修改space_mtag.php和spache_mtag.html文件,捣鼓了半天也没有搞好,谁弄过,帮我修改一下。

效果图如下

回复讨论(解决方案)

无限分类的代码如下

 <?php$link   = mysql_connect( '127.0.0.1', 'root', '500000' ) or die( mysql_error() );//连接数据库服务器          mysql_select_db( 'test' );//选择数据库          mysql_set_charset( 'utf8' );//设置字符编码              $sql = "SELECT * FROM wxtree";//查询分类表          $result = mysql_query( $sql );            $tree = array();//初始化一个数组          while( $row  = mysql_fetch_assoc( $result ) )                 {                 	                      $tree[$row['fid']][$row['id']]  = $row['cat_name'];//创建分类数组                                                                   }          mysql_close( $link );//关闭数据库		          print_r($tree[02]);echo '-------------------------------------------' . "\n"; //递归函数  function for_category( $arr = array(), $arr2 ){	      echo "<ul>";    foreach ( $arr as $k => $v )    {          if ( isset( $arr2[$k] ) && is_array( $arr2[$k] ) )        {          	   echo "<li>$k $v  &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp编辑&nbsp&nbsp&nbsp 删除";             for_category( $arr2[$k], $arr2 );                        echo "</li>";                  }        else{             echo " <li>$k $v &nbsp&nbsp&nbsp<a href="space.php?do=mtag&view=hot"> <span>热门群组ddd</span> </a> &nbsp&nbsp&nbsp编辑&nbsp&nbsp&nbsp 删除 </li>" ;        }                  }     echo "</ul>";  }   for_category( $tree[0], $tree );?>

其中32行加入链接报错啊

echo " 

  • $k $v     热门群组ddd     编辑    删除 
  • " ;

    echo " 
  • $k $v     热门群组ddd     编辑    删除 
  • " ;

    可以啦,谢谢高手就是不一样,,积分全给啦

    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn