Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7903817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:50:31+00:00 2026-06-03T09:50:31+00:00

Am using jsTree + PHP, and I would like to load up two different

  • 0

Am using jsTree + PHP, and I would like to load up two different trees from two different database tables, depending on what user type the logged in user is.

I tracked down the code to the “class.tree.php” file,

class json_tree extends _tree_struct {  
function __construct($table = 'tree', $fields = array(), $add_fields = array("title" => "title", "type" => "type")) {
parent::__construct($table, $fields);
    $this->fields = array_merge($this->fields, $add_fields);
    $this->add_fields = $add_fields;
}

Where the $table = ‘tree’ is hard-coded. I tried removing it (so just $table), and passing ‘tree’ through as

$jstree = new json_tree('tree');

but that didn’t work. Any ideas/help would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:50:32+00:00Added an answer on June 3, 2026 at 9:50 am

    To those curious, I had completely forgotten that server.php also includes a jstree (I had also initiated it in my left menu). For those interested, or who need a conditional based tree, what I did was:

    • removed the $table = ‘tree’ in the __construct as above, which becomes
      function __construct($table, $fields = array(), $add_fields = array("title" => "title", "type" => "type"))
    • added a session to the config.php (session_start())
    • I have a log in, which allows me to get the condition
    • in server.php, I did the following
      if($_SESSION['condition'] == 1) { $jstree = new json_tree("tree");}
      else { $jstree = new json_tree("tree_users");}

    I hope this helps someone!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jsTree (pre1.0_fix_1), I would like to obtain a list of id 's for
I'm new with jsTree and I would like to create a tree starting from
Using a restful resource in Rails, I would like to be able to insert
Using Flex 3, I would like to take an image snapshot such as this:
Here's my situation: using PHP and MySQL as my backend, jQuery and jsTree for
I'm using jsTree and I have 2 textboxes: <input type=text id=previous_tree_id value= /><hr />
I have two questions regarding jsTree: I am generating a jsTree using JSON with
I am following the tuturoial here: http://backbonetutorials.com/organizing-backbone-using-modules/ and all I would like to do
am using $(#demo1).jstree({ xml_data : { ajax : { url : phpxml.php, data :
I am using the latest jstree commit from github with the checkbox plugin as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.