Home > php教程 > php手册 > xzn_html_tree1.0可折叠大纲

xzn_html_tree1.0可折叠大纲

WBOY
Release: 2016-06-13 10:24:37
Original
985 people have browsed it

/** 可折叠大纲 * 类名 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; } } /** 树类 * 用于保存和输出可折叠大纲 * 可折叠大纲使用FrontPage 2000的JavaScript脚本 * * 方法 * set() * 设置节点,节点编号采用1.2.3.4或1-2-3-4的形式。 * 无层次限制。输入次序不限。 * @param $id 节点号 * @param $text 节点标题 * @param $value 节点参数,一般为url * @param $image 节点图片 * * display() * 向页面输出可折叠大纲 * * 属性 * @public $node 数组,用于保存节点 * @public $jspath 脚本outline.js存放位置 */ class Tree { var $node; var $jspath; function set($id,$text,$value="",$image="plus.gif") { $d = split("[.-]",$id); $e = ""; for($i=0;$inode$e;"); $p[node] = $n; } function display() { echo ." "; echo ." "; echo ." "; echo ." "; ksort($this->node); reset($this->node); while(list($key,$value) = each($this->node)) { $this->next($value,0); } echo " "; } function next($node,$level) { if(! is_array($node)) return; if(isset($node[node])) { // echo $level.",".$node[node]->id.",".$node[node]->text.",".$node[node]->value.",".$node[node]->image." "; echo ." "; echo image.">." "; 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 " "; } } ?>

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template