Results 1 to 15 of 15

Thread: Treeview structure in PHP

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Resolved Treeview structure in PHP

    Hello All

    Can somebody help me in getting a treeview structure uisng PHP script. I would be fetching the details from database. I am looking for something like this

    - Parent1
    - Child1
    - Subchild1
    Content
    - Parent2
    + Child2
    - Child3
    - Content

    A -ve sign need to be shown if it is expanded , If not a +ve sign.

    Can we do this is PHP Script .. Can somebody help me please.

    Thank You
    Neha
    Last edited by NehaRao; Dec 25th, 2009 at 08:42 AM.

  2. #2
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Treeview structure in PHP

    could you explain a bit more, because i believe this would be simple... where does the parent come from and where dose the child come from? and the content is that in the tree view or outside?

    edit: could this help you with you want done?

    http://www.berthou.com/us/2008/03/27...eeview-in-php/
    Last edited by Justa Lol; Dec 25th, 2009 at 09:33 AM.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Treeview structure in PHP

    Hello Justa

    That is what exactly I wanted to do . Thansk for the example. But Now I need to fetch my details from the database.

    Parent and childs comes from MySQL DB. When I pass the parent value , I Can fetch the child value and so on.. Hope I answered ur question

    Thank You So much for immediate help

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Treeview structure in PHP

    you pretty much just have to fetch everything that would appear in the tree at the time; so you must fetch all of the titles, and then for every title that is "open," you must fetch the subtitles, and for every subtitle, you must fetch the content. the easiest way to build it, in my opinion, is using a big array. you could probably store the menu's look in a session, or the query string.

    I have absolutely no idea how you would manage this using the class listed above. the documentation for how to use it effectively doesn't even exist, but it does have a few examples; these don't seem too helpful, though. this class allows you to use text files to generate a menu, so you could cache a copy of your database in the textfile in the treeview class format so that it could use it. sounds like a pain though.

    if you don't possess the knowledge to build this yourself, I'd suggest googling to find another tree-view generator instead. one that can build a tree-view from an array, or something.
    Last edited by kows; Dec 25th, 2009 at 11:53 AM.

  5. #5
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Treeview structure in PHP

    http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

    i haven't got time to make anything, sorry for that, but i found a link you could try experimenting with...

  6. #6
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Treeview structure in PHP

    that really doesn't help all that much; the issue is the ability to get the content and put it into the tree, not making a tree view itself. :/

  7. #7
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Treeview structure in PHP

    well sorry about, i wish i could help right now but i can't, I'm too busy making a website(not for my self)... got 3 people asking me to make them websites for cash, finally got something for my knowledge, but still my 8 languages aren't useful as i'm not an interpreter.. hehehe

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Treeview structure in PHP

    I still couldnt arrive at any solution for the issue. As Kows said, its not about building the treeview. Its about populating the content from the database into treeview.

    Parent1
    ----->Child1
    --->SubChild11
    -------> Child11Content
    --->SubChild12
    -------> Child12Content
    Parent2
    ----->Child1
    ----->Child2
    --->SubChild21
    -------> Child21Content
    --->SubChild22
    -------> Child22Content

    The relation and content between parents and childs is stored in mySQL DB.

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Treeview structure in PHP

    Hello

    Thanks Justa

    I did achieve using the example explained in

    http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

    Thanks for it

  10. #10
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: [RESOLVED] Treeview structure in PHP

    oh man sorry i completely forgot this topic!

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: [RESOLVED] Treeview structure in PHP

    Hello All

    My above solution is not working in realtime. It is hitting the performance badly. I believe that the tree is loaded at the time of page loading. Its not dynamic. I would want the childs to be loaded only when the parent node is clicked . When the parent node is clicked I want to query the MySQL DB and get the childs and populate the tree.

    Can anyone help me please.

    Thanks
    Neha

  12. #12
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: [RESOLVED] Treeview structure in PHP

    you didn't ever post your solution, so it's a little hard to help.

  13. #13

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Treeview structure in PHP

    Hello

    I have implemented the same solution explained in

    http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

    Thanks

  14. #14
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Treeview structure in PHP

    that solution is simply JavaScript playing with HTML. it sounds like you're looking for an ajax-powered treeview.

  15. #15
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Treeview structure in PHP

    Your threads have been merged.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width