HOW TO create tree menu works with different links?

Discuss everything related to ApPHP TreeMenu. Any questions related to the ApPHP TreeMenu developing or using should be posted to this forum.

Moderators: ne_moj, zewa, Milton

administrator
Site Admin
Site Admin
Posts: 5922
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO create tree menu works with different links?

Postby administrator » Nov 17th, '10, 21:12

Sometime you need to create a side menu, that will work like tree menu and will reopen the page with different parameters.

Here the possible example:

$italy=$treeMenu->AddNode("Italy","index.php?page=category&cid=1");
$italy->OpenNewWindow(true);
$rome = $italy->AddNode("Rome","index.php?page=category&cid=2");
$rome->OpenNewWindow(true);
$milan = $italy->AddNode("Milan","index.php?page=category&cid=3");
$milan->OpenNewWindow(true);


and a result:
untitled.PNG
untitled.PNG (1.42 KiB) Viewed 2258 times

Melisabz
Newbie
Newbie
Posts: 1
Joined: May 21st, '16, 11:43
Location: Chennai
Contact:

Re: HOW TO create tree menu works with different links?

Postby Melisabz » May 21st, '16, 11:53

I tried this code, but i have received some bug. Can you please check above code as working good or not

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: HOW TO create tree menu works with different links?

Postby ne_moj » May 23rd, '16, 06:16

Hello Melisabz

Here is a working example, but you have to specify where is located the module TreeMenu:

Code: Select all

   if(!defined('TREEMENU_DIR')){
      ## *** include TreeMenu class
      define ('TREEMENU_DIR', 'modules/treemenu/');                  /* Ex.: 'treemenu/' */
      ## *** include TreeMenu class
      require_once(TREEMENU_DIR.'treemenu.class.php');
   }
   ## *** create TreeMenu object
   $treeMenu = new TreeMenu();
        ## *** set text direction
   $treeMenu->SetDirection(Application::Get('lang_dir'));
   ## *** set unique numeric (integer-valued) identifier for TreeMenu
   ## *** (if you want to use several independently configured TreeMenu objects on single page)
   $treeMenu->SetId(99);
   ##  *** set style for TreeMenu
   $treeMenu->SetStyle('vista');
   ## *** show debug info - false|true
   $treeMenu->Debug(false);
   ## *** set postback method: 'get', 'post' or 'ajax'
   $treeMenu->SetPostBackMethod('post');
   ## *** show number of subnodes to the left of every node - false|true
   $treeMenu->ShowNumSubNodes(true);
       
   $italy=$treeMenu->AddNode("Italy","index.php?page=category&cid=1");
   $italy->OpenNewWindow(true);
   $rome = $italy->AddNode("Rome","index.php?page=category&cid=2");
   $rome->OpenNewWindow(true);
   $milan = $italy->AddNode("Milan","index.php?page=category&cid=3");
   $milan->OpenNewWindow(true);
   
   $treeMenu->ShowTree();


Return to “ApPHP TreeMenu”