The following is a tree-like menu with a style similar to Windows Explorer
Include the following script in your page
Also need to intercept some GIF pictures from the Explorer, see the comments in the script
The format of the menu structure file is:
Tree Level|item text|item link|link target|last item in subtree
For example
.
Demo Menu|javascript:alert (' This was the demo menu for Treemenu 1.0 ');
..
Catalog 1
...
Sub-Directory 1.1
... item 1.1.1|javascript:alert (' Item 1.1.1 ');
... item 1.1.2|javascript:alert (' Item 1.1.1 ');
... item 1.2|javascript:alert (' Item 1.2 ');
... item 1.3|javascript:alert (' Item 1.3 ');
..
Sub-Catalog 2
... item 2.1|javascript:alert (' Item 2.1 ');
... item 2.2|javascript:alert (' Item 2.2 ');
...
Sub-directory 2.3
... item 2.3.1|javascript:alert (' Item 2.3.1 ');
... item 2.3.2|javascript:alert (' Item 2.3.2 ');
File:tremenu.inc
PHP Treemenu
/////////////////
Initialize//
/////////////////
$treefile = "Demomenu.txt";//File with menu structure
if (Isset ($PATH _info))
$script = $PATH _info;
Else
$script = $SCRIPT _name;
A picture that intercepts the corresponding location in Windows Explorer
$img _expand = "tree_expand.gif";//shapes such as the Extensible node in Resource Manager +
$img _collapse = "tree_collapse.gif";//shaped as an extension node in the Explorer-
$img _line = "tree_vertline.gif";//Shape like |
$img _split = "tree_split.gif";//Shape like |
$img _end = "tree_end.gif";//Shaped like L
$img _leaf = "tree_leaf.gif";//Shaped like O
$img _SPC = "tree_space.gif";//Blank graph
Here is the menu processing script
$maxlevel = 0;
$cnt = 0;
$FD = fopen ($treefile, "R");
if ($fd ==0) die ("Treemenu.inc:Unable to open File". $treefile);
while ($buffer = Fgets ($FD, 4096))
{
$tree [$cnt][0]=strspn ($buffer, ".");
$tmp =rtrim (substr ($buffer, $tree [$cnt][0]);
$node =explode ("|", $tmp);
$tree [$cnt][1]= $node [0];
$tree [$cnt][2]= $node [1];
http://www.bkjia.com/PHPjc/631785.html www.bkjia.com true http://www.bkjia.com/PHPjc/631785.html techarticle The following is a tree-like menu with a style similar to Windows Explorer to include the following script in your page you also need to intercept some GIF images from the explorer, and see the note in the script ...