Forums: Tree view - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Tree view

#1 User is offline   Pavel Nefyodov 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 27-January 10
  • Gender:Male
  • Location:Lancashire
  • Interests:Golf, cricket.

Posted 04 February 2010 - 01:18 PM

PHPRunner 5.1 version
Tree view question

I was trying to get flexible tree menu view working.

Initially, I have created tree-like menu in menu builder then I started to change

displaymenu.php.



Instead of this code:

 // create menu nodes arr

            $menuNodes = array();

            $menuNode = array();

            $menuNode["name"] = "Root";

            $menuNode["nameType"] = "Text";

            $menuNode["id"] = "1";

            $menuNode["parent"] = "0";

            $menuNode["style"] = "";

            $menuNode["href"] = "";

            $menuNode["table"] = "";

            $menuNode["type"] = "Group";

            $menuNode["linkType"] = "None";

            $menuNode["pageType"] = "List";

            $menuNode["openType"] = "None";                                                       

 

            // set title                    

            $menuNode["title"] = "Root";

                                    

            $menuNodes[] = $menuNode;    

            $menuNode = array();

            $menuNode["name"] = "";

            $menuNode["nameType"] = "Text";

            $menuNode["id"] = "2";

            $menuNode["parent"] = "1";

            $menuNode["style"] = "";

            $menuNode["href"] = "";

            $menuNode["table"] = "dbo.New_Folders";

            $menuNode["type"] = "Leaf";

            $menuNode["linkType"] = "Internal";

            $menuNode["pageType"] = "List";

            $menuNode["openType"] = "None";                                                       

 

            // set title                    

            $menuNode["title"] = "New Folders1";

                                    

            $menuNodes[] = $menuNode;



Where table “New_Folder” is


ID Title description parent

1 Root Root folder NULL

2 New Folder First folder 1




I inserted

$menuNodes = array(); 

 

global $conn;

            $stringSQL = "SELECT [ID] as ID

             ,[title] as title

            ,[description] as description

            ,iSNULL([parent], 0) as parent

            FROM [FAQ].[dbo].[New_Folders] order by id, parent" ; 

           

$rs=db_query($stringSQL,$conn);

 

           while ($row = db_fetch_array($rs)) 

            {               

                                    $menuNode = array();

                                    $menuNode["name"] = $row['title'];

                                    $menuNode["nameType"] = "Text";

                                    $menuNode["id"] = (string) $row['ID'];

                                    $menuNode["parent"] = (string) $row['parent'];

                                    $menuNode["style"] = "";

                                    $menuNode["href"] = "";

                                    $menuNode["table"] = "";

                                    $menuNode["type"] = "Group";

                                    $menuNode["linkType"] = "None";

                                    $menuNode["pageType"] = "List";

                                    $menuNode["openType"] = "None";       

                                    $menuNode["title"] = $row['title'];

                                    $menuNodes[] = $menuNode;

                                    }




So basically I wanted my tree structure populated from the database.

It didn’t work even though connection to database worked properly.

The thing is, when I have created initially only 2 nodes it worked for two nodes from my table “New_Folder”

but other entries were ignored.

Also I created long menu tree (from user interface) that worked, but when I inserted the code (everything between

“$menuNodes = array();” and “$menuNodes[] = $menuNode;” from displaymenu.php) into the same project

from which I have deleted couple of nodes, it didn’t work.


Does PHPRunner 5.1 store the data about tree structure somewhere else (except for displaymenu.php)?
0

#2 User is offline   scubadiver 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 60
  • Joined: 17-November 06

Posted 15 March 2010 - 08:16 PM

View PostPavel Nefyodov, on 04 February 2010 - 09:18 AM, said:

Does PHPRunner 5.1 store the data about tree structure somewhere else (except for displaymenu.php)?


Pavel - did you find the answer to this question?
[/color]omic Sans MS"]to err is.... expected
0

#3 User is offline   Pavel Nefyodov 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 27-January 10
  • Gender:Male
  • Location:Lancashire
  • Interests:Golf, cricket.

Posted 08 April 2010 - 08:39 AM

View Postscubadiver, on 15 March 2010 - 08:16 PM, said:

View PostPavel Nefyodov, on 04 February 2010 - 09:18 AM, said:

Does PHPRunner 5.1 store the data about tree structure somewhere else (except for displaymenu.php)?


Pavel - did you find the answer to this question?

Yes, thank you. Eventually I have created tree structure populated from the database.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users