在common.func.php 中增加
- /获取论坛分类
- function getbbscategory($space = "|----", $delbase = 0 )
- {
- global $_SGLOBAL;
- include_once( S_ROOT."./class/tree.class.php" );
- $tree = new tree( $type );
- $query = $_SGLOBAL['db']->query( "SELECT * FROM ".tname( "forums", 1 )."ORDER BY fid, displayorder" );
- $miniupid = "";
- $delid = array( );
- if ( $delbase )
- {
- $delid[] = $delbase;
- }
- while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
- {
- if ( $miniupid == "" )
- {
- $miniupid = $value['fup'];
- }
- $tree->setnode( $value['fid'], $value['fup'], $value );
- }
- $listarr = array( );
- if ( 0 < $_SGLOBAL['db']->num_rows( $query ) )
- {
- $categoryarr = $tree->getchilds( $miniupid );
- foreach ( $categoryarr as $key => $catid )
- {
- $cat = $tree->getvalue( $catid );
- $cat['pre'] = $tree->getlayer( $catid, $space );
- if ( !empty( $delid ) && ( in_array( $cat['fup'], $delid ) || $cat['fid'] == $delbase ) )
- {
- $delid[] = $cat['fid'];
- }
- else
- {
- $listarr[$cat['fid']] = $cat;
- }
- }
- }
- return $listarr;
- }
复制代码 |