How do I create multiple trees in loaded document?

Explorer like navigation tree for websites
Navigationsbaum für Internet Auftritte.
Post Reply
Guest

How do I create multiple trees in loaded document?

Post by Guest »

Hi Everyone,

According to this program -
Multiple trees may be loaded in one document

How Do I do this?
I want 3 Trees in 1 Document.

Could someone please help me ? :roll:
User avatar
Hans
Site Admin
Posts: 77
Joined: 16 Dec 2005, 16:52
Location: Germany
Contact:

Multiple trees

Post by Hans »

Hello,

to include multiple trees in one document you only have to instantiate and show each tree using a different name, e.g. code in your menu-file:

Code: Select all

treeA=new treemenu('treeA',...);
...
document.write(treeA);
treeB=new treemenu('treeB',...);
...
document.write(treeB);
treeC=new treemenu('treeC',...);
...
document.write(treeC);
That's all. For further questions don't hesitate to ask.

Thank you for using TreeMenu
Hans
Your forum admin
Guest

re: Mutliple Trees

Post by Guest »

Hi, thankyou very much for your assistance, but i am still trying to understand how to write the code. (My apology I am still very new to this)

You said you have to instantiate and show each tree using a different name.

I am using the sample file that come with .ZIP file.

Code: Select all

treeA=new treemenu('treeA',...); 
... 
document.write(treeA); 
treeB=new treemenu('treeB',...); 
... 
document.write(treeB); 
treeC=new treemenu('treeC',...); 
... 
document.write(treeC);


Could you show me how to do it for:

Code: Select all

   tree.put(1,'TreeMenu',             'main','eng/tree/treemenu.html',      '',                            'gif/tree.gif',     'gif/tree.gif'     );
   tree.add(0,' First steps',         '',    '',                            'First steps to start',        '',                 ''                 );
   tree.add(1,'  Preparations',       'main','eng/tree/preparations.html',  'Preparations for usage',      '',                 ''                 );
   tree.add(1,'  Create instance',    'main','eng/tree/instance.html',      'Instance and settings',       '',                 ''                 );
   tree.add(1,'  Menu items',         'main','eng/tree/items.html',         'How to create items',         '',                 ''                 );
   tree.add(1,'  Show menu',          'main','eng/tree/show.html',          'How to show the menu',        '',                 ''                 );
   tree.add(1,'  Select item',        'main','eng/tree/select.html',        'Selecting an item',           '',                 ''                 );
   tree.add(0,' Advanced',            '',    '',                            'Advanced usage',              '',                 ''                 );
   tree.add(1,'  Formats',            'main','eng/tree/formating.html',     'Format the items',            '',                 ''                 );
   tree.add(1,'  Multilingual',       'main','eng/tree/multilingual.html',  'More than one language',      '',                 ''                 );
   tree.add(1,'  Direct access',      'main','eng/tree/directaccess.html',  'Direct acces to a page',      '',                 ''                 );
   tree.add(0,' Update',              'main','eng/tree/update.html',        'How to update treemenu',      '',                 ''                 );
   tree.add(0,'Config',               '',    '',                            'Configure the menu',          'gif/conf.gif',     'gif/conf.gif'     );
   tree.add(1,' Introduction',        'main','eng/conf/introduction.html',  'Overview of configuration',   '',                 ''                 );
   tree.add(1,' Usage',               'main','eng/conf/usage.html',         'To include and use with menu','',                 ''                 );
   tree.add(1,'Use',                  '',    '',                            'Terms of usage',              'gif/openbook.gif', 'gif/openbook.gif' );
   tree.add(1,' Liability',           'main','eng/use/liability.html',      'Liability of usage',          'gif/paragraph.gif','gif/paragraph.gif');
   tree.add(1,' Copyright',           'main','eng/use/copyright.html',      'Copyright of the scripts',    'gif/copyright.gif','gif/copyright.gif');
   tree.add(1,' Wishes',              'main','eng/use/wishes.html',         'Wishes to the users',         'gif/wishes.gif',   'gif/wishes.gif'   );

   var  query = location.search;                                                                            // query for direct-access
   if (query) {                                                                                             // If there is a non-empty query
     if      (query.substr(0, 13)=="?treemenu,eng")     tree.selectPath("eng/tree/treemenu.html");          // -> Preselect the appropriate
     else if (query.substr(0, 17)=="?preparations,eng") tree.selectPath("eng/tree/preparations.html");      //    page by giving the
     else if (query.substr(0, 13)=="?instance,eng")     tree.selectPath("eng/tree/instance.html");          //    associated path
     else if (query.substr(0, 10)=="?items,eng")        tree.selectPath("eng/tree/items.html");           } //

   document.write(tree);
//-->
How do you say document.write(tree) for 3 instances?

:lol:
User avatar
Hans
Site Admin
Posts: 77
Joined: 16 Dec 2005, 16:52
Location: Germany
Contact:

Such easy

Post by Hans »

Hello,

in my 1.st reply you find three code blocks, each for one tree, named treeA (the first tree), treeB (the second tree) and treeC (the third tree).

Each tree is handled separated as indicated with the line containing the three dots between the instantiation [e.g.: treeA=new treemenu('treeA',...);] and the writing of the tree into the document [e.g.: document.write(treeA);]. To fill the trees you have to replace the dotted line with your put- or add-commands. E.g. for the first tree 'treeA':

Code: Select all

treeA=new treemenu('treeA', true, true, true, false);
treeA.put(...);
treeA.add(...);
...
document.write(treeA);
Do the same for the trees 'treeB' and 'treeC':

Code: Select all

treeB=new treemenu('treeB', true, true, true, false);
treeB.put(...);
treeB.add(...);
...
document.write(treeB);

treeC=new treemenu('treeC', true, true, true, false);
treeC.put(...);
treeC.add(...);
...
document.write(treeC);
The description for the put and add-commands are given in the help: First steps -> Menu items. You will have to replace the dots inside the put- and add-command with the informations you want to show with the tree.

Hope this helps.
Hans
Last edited by Hans on 29 Mar 2006, 10:26, edited 1 time in total.
Your forum admin
Guest

re: Multiple Tree Views

Post by Guest »

Hi again,

I think i understand now. Do you mean to say:

Code: Select all

treeA=new treemenu('treeA', true, true, true, false); 
Would be represented as example:

Code: Select all

 tree.put(1,'TreeMenu',             'main','eng/tree/treemenu.html',      '',                            'gif/tree.gif',     'gif/tree.gif'     );
I will have a play and let you know if I run into any trouble.
Again, I really appreciate your help with this.
User avatar
Hans
Site Admin
Posts: 77
Joined: 16 Dec 2005, 16:52
Location: Germany
Contact:

No!

Post by Hans »

Hi,

you must not write 'tree' for the instance of your first tree, which is now named 'treeA'. You must write

Code: Select all

treeA.put(...);
and not

Code: Select all

tree.put(...) ;
to fill in the informations for your first 'treeA'.

(Topic splittet here, continuation in 'Multiple trees in a table' by Hans 2006-03-30)
Your forum admin
Post Reply