a question about 'nested sets' |
[eluser]arlong[/eluser]
hi.my english is not good. i want make a commenting system like reddit.(http://www.reddit.com/r/funny/comments/f...ng_in_the/) im using fot nested sets model(http://codeigniter.com/wiki/Nested_sets/). but it is not maked for a commenting system.itis maked for a recursive menu system(i think). how can i adaptation this model(adaptation) for my commenting system?
[eluser]WanWizard[/eluser]
Nested sets are about hierarchical data structures, or tree structures. All you need is a table with an (autoincrement) id column, and left- and right pointer columns. These tree columns define the tree structure. What other fields you add to the table is up to you. To implement such a structure, simply add any reply as last child of the message id being replied to.
[eluser]arlong[/eluser]
id, right,left is not? could you write a example? i cant make a database plan for this commenting system.
[eluser]WanWizard[/eluser]
There's an example in the zip file, and some comments on the wiki page. If, based on the information provided, you're unable to create a table (there's even an example sql file included), I suggest you read up on nested sets first, so you understand what they do and how they work. I don't use the code from the wiki, so I don't have an example for you. |
Welcome Guest, Not a member yet? Register Sign In |