<?
@set_time_limit(1200);
/*
//类文件char_class.php
+--------------------------------------------------------------------------
| 数据库说明
| bid 本类id
| top_id 父类id
| catname 本类名称
| catord 本类序列号
| catiffb 显示状态
| attr
|
+--------------------------------------------------------------------------
*/
class Char_class {
/*
+------------------------------------------------------------------------------------------------------
| 功能说明: 根据类表生成树型图.
| 调用部分 :
| ========================================
| $test_array = get_page_children($node_cache,0, $node_cache,0);
|
| echo "\n<select name=select>\n";
|
| $last = "├─";
| foreach($test_array as $key=>$val)
| {
| $item = str_repeat(" │ ",$val['depth']);
| echo "<option value=".$val['id'].">".$item.$last.$val['name']."</option>\n";
| $item = '';
| }
|
+------------------------------------------------------------------------------------------------------
*/
function &get_page_children($id, $node,$depth=0)
{
global $node_cache;
if ( empty($node) )
{
$node = &$node_cache;
}
$depth++;
$tree_list = array();
foreach ($node as $leap)
{
if ($leap['parentId'] == $id)
{
$leap['depth'] = $depth - 1;
$tree_list[] = $leap;
if ( $children = $this->get_page_children($leap['id'], $node,$depth))
{
$tree_list = array_merge($tree_list, $children);
}
}
}
return $tree_list;
}
/*
+------------------------------------------------------------------------------------------------------
| 功能说明: 利用根据类表生成树型图的函数,生成一个下拉列表.
|
+------------------------------------------------------------------------------------------------------
*/
function get_page_select($Selectname,$Id,$Ex)
{
global $node_cache;
$Array = $this->get_page_children(0, $node_cache,0);
$Table = "";
$Table .=" <select name='".$Selectname."' ".$Ex.">\n";
$Table .=" <option value=0>├─Root</option>\n";
$last = "├─";
foreach($Array as $key=>$val)
{
$item = str_repeat("│",$val['depth']);
$Table .= "<option value='".$val['id']."'";
if (intval($Id)==intval($val['id'])){
$Table .= " selected ";
}
$Table .= ">".$item.$last.$val['name']."</option>\n";
$item = '';
}
return $Table;
}
//在前台搜索中用的
function get_page_select_forsearch($Zero_say,$Selectname,$Id,$Ex)
{
global $node_cache;
$Array = $this->get_page_children(0, $node_cache,0);
$Table = "";
$Table .=" <select name='".$Selectname."' ".$Ex.">\n";
$Table .=" <option value=0>".$Zero_say."</option>\n";
$last = "├─";
foreach($Array as $key=>$val)
{
$item = str_repeat("│",$val['depth']);
$Table .= "<option value='".$val['id']."'";
if (intval($Id)==intval($val['id'])){
$Table .= " selected ";
}
$Table .= ">".$item.$last.$val['name']."</option>\n";
$item = '';
}
return $Table;
}
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
php树形菜单类.rar
共7个文件
php:6个
phpbakbak:1个
4星 · 超过85%的资源 需积分: 0 64 下载量 2 浏览量
2008-10-04
13:46:49
上传
评论
收藏 5KB RAR 举报
温馨提示
php树形菜单类 包含类数据库 参加删除等操作! 比较完整的无限分类源代码! 就是没有生成无限导航的部分
资源推荐
资源详情
资源评论
收起资源包目录
php树形菜单类.rar (7个子文件)
char
diaoyong.php 2KB
Productclass_show.phpbakbak 1KB
char_class.php 3KB
Newclass_show.php 2KB
Newclassshow.php 143B
Manager_Class.php 1KB
Productclass_show.php 959B
共 7 条
- 1
网络蛀虫
- 粉丝: 5
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页