- The configuration files (demo*Nodes.js) in the downloaded ZIP have an initial section where some global variables are set (described above) and then a section for the actual creation of folders and links. Here we describe those tree-construction commands. The examples given are taken from the demoFrameset.html example.
1. Create the root folder. Use this command:
foldersTree = gFld("Demo", "demoFramesetRightFrame.html")
The function gFld takes a name and an optional URL, and returns the folder. You can give any name to your root folder and to the other folders inside of it. Note how even some formatting (italics) was used in the example above. You can also add an IMG tag to place a small icon in the folder name (for example a "new!" icon.)
The URL must either be just a file name (for example: demoFramesetRightFrame.html) or an whole URL complete with protocol (for example: http://www.treeview.net/treemenu/dem...ere_europe.gif).
To learn more about gFld, see the section below "The optional link of the folder icon."
2. Place folders inside other folders by using the function 'insFld([parent folder], [child folder])'. For example:
aux1 = insFld(foldersTree, gFld("Europe", "http..."))
3. To create a document link use the function 'gLnk'. It takes three arguments:
Target:
'R' opens in the right frame (a frame named basefrm),
'B' opens in a new window,
'T' opens in the current browser window, replacing the frameset if one exists,
'S' opens in the current frame, replacing the tree.
Note: the function is case sensitive; use uppercase.
(For more info on the "doc type" argument see the section below named "More about the gLnk function."
Title: Text to be displayed in the tree for that node. This text can include some simple HTML, such as enclosing formatting tags (I, B, DIV, etc.), or even an IMG tag to place a small icon in the node name (for example: a "new!" icon.)
Link: URL of the document (may be absolute or relative.) Do not enter other information in this string. Adding a target parameter or an event handler will not work.
4. To place the document inside the tree use the function 'insDoc([parentfolder], [document link])'.
Note: If you want to rename some of the files included in the .ZIP, you will have to take in account the file dependencies: you may want to rename demoFramesetRightFrame.html but then you will need to update both demoFramesetNodes.js and demoFrameset.html. The file demoFrameset.html itself (the one most exposed to visitors) can be renamed without any problems with dependencies. Do not rename any other file.
More about the gLnk function
The first argument of the gLnk function not only controls the target of the page (right frame, new window, etc.) but may also help in the construction of the link itself. After the character that controls the target (R,B,etc.), add an extra lowercase character to the string. This extra character will specify the protocol to be prepended to the URL. If you do this you may leave the protocol out of the string given in the third argument. Example:
gLnk("Rh", "Right frame", "www.x.net/y/z.html"))
These are the protocols the Treeview applet may prepend automatically, if there is interest in keeping the configuration file as small as possible: h: http:// , s: https:// , f: ftp:// , m: mailto: .
ok, xo se metto aux1 = insFld(foldersTree, gLnk("News", "Right frame", "news.php"))
mi esce Right Frame al posto di News, e mi apre news.php in una finestra nuova...

Rispondi quotando