The tree view

Hi every one,

Im a new Yii Framework user and i have some problems to generate a tree from a database table. For example:

I have a table with a disk, a folder and a file id with their associated names:

d_id    d_name  fd_id   fd_name         fl_id   fl_name

1 	disk1 	1 	folder1 	1 	file1

1 	disk1 	1 	folder1 	2 	file2

1 	disk1 	3 	folder3 	3 	file3

1 	disk1 	4 	folder4 	4 	null

2 	disk2 	5 	folder5 	5 	file5

2 	disk2 	6 	folder6 	6 	null

And i want to generate a tree like this:

-1 disk1

   - 1 folder1

        1 file1 // link to file 1

        2 file2 // link to file 2   

   - 3 folder3

        3 file3

     4 folder4

Is it possible with the CTreeView?

I tried to do something similaire to the tree view eplained in the cookbook70 but its not similaire to the results that i’m expecting to, because it shows only a basic tree with one level, which is not the same as mine, also its doesn’t use the same data structure as mine

Thanks in advance

is this forum active ???? cause each time i post something no one answer :huh:

Perhaps this can help

CTreeView API


I already read the Api but it didn’t help me a lot for what i want

to do exactly.

Thanks anyway :)


I’m new on Yii, and I have the same problem.

Did you solve it?

i have the same problem … how can i pass selected data from database to CTreeView?

You pass the data array: