/** 可折叠大纲 * 类名 Tree * 存放位置 xzn/html/tree.php */ /** 节点类 * 用于在树中保存相关参数 * * @param $id 节点号 * @param $text 节点标题 * @param $value 节点参数,一般为url * @param $image 节点图片 */ class TreeNode { var $id; var $text; var $value; var $image; function TreeNode($id,$text,$value,$image) { $this->id = $id; $this->text = $text; $this->value = $value; $this->image = $image; } } /**Tree class * Used to save and output the collapsible outline * The collapsible outline uses JavaScript script of FrontPage 2000 * * Method * set() * Set the node, the node number is in the form of 1.2.3.4 or 1-2-3-4. * No level restrictions. The input order is not limited. * @param $id Node number* @param $text Node title* @param $value Node parameter, usually url * @param $image Node picture* * display() * Output collapsible outline to the page* * Attributes* @public $node array, used to save nodes* @public $jspath script outline.js storage location*/ class Tree { var $node; var $jspath; function set($id,$text,$value="",$image="plus.gif") { $d = split("[.-]",$id); $e = ""; for($i=0;$iimage.">."
"; echo ; if(empty($node[node]->value)) echo $node[node]->text."
"; else echo value.">.$node[node]->text."
"; echo ."
"; } if(count($node) == 1) { echo "
"; return; } ksort($node); reset($node); while(list($key,$value) = each($node)) { $this->next($value,$level+1); } echo "
"; } } ?>