what does left_id and right_id in the table forums?

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
frank burian
Registered User
Posts: 5
Joined: Fri Jun 15, 2007 7:47 am

what does left_id and right_id in the table forums?

Post by frank burian »

Hey,

can me tell someone for which, the columns "left_id" and "right_id" in the table "forums", it is? and how it builds itself when i insert a forum in the admin panel?

thx, i hope you understand me!?
Frank

frank burian
Registered User
Posts: 5
Joined: Fri Jun 15, 2007 7:47 am

Re: what does left_id and right_id in the table forums?

Post by frank burian »

no answer!

User avatar
A_Jelly_Doughnut
Registered User
Posts: 1780
Joined: Wed Jun 04, 2003 4:23 pm

Re: what does left_id and right_id in the table forums?

Post by A_Jelly_Doughnut »

The two columns constitute a binary tree.
http://en.wikipedia.org/wiki/Binary_tree
A_Jelly_Doughnut

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: what does left_id and right_id in the table forums?

Post by naderman »

It's just a general tree and not a binary tree as you can have more then just 2 subforums in a forum ;-) The numbers are necessary to efficiently use a tree stored in a relational database. There's an interesting tutorial explaining the basics on sitepoint: http://www.sitepoint.com/article/hierar ... a-database

alcaeus
Registered User
Posts: 66
Joined: Sun Oct 10, 2004 3:21 am
Location: Munich (Germany)
Contact:

Re: what does left_id and right_id in the table forums?

Post by alcaeus »

The structure is called a Nested set ;)
It's a special kind of tree: you store the tree in a linear structure (your database) and re-assemble it into a tree in linear time complexity. Of course, completely rebuilding the tree or adding/deleting items is not completely trivial, but since those actions are not done that often, it doesn't matter that much.

Greetz
alcaeus

god0fgod
Registered User
Posts: 4
Joined: Sun Jun 24, 2007 3:49 pm

Re: what does left_id and right_id in the table forums?

Post by god0fgod »

This was the closest thing to the answer I want. Can anyone please tell me how I would make the numbers for these columns? Does it matter? Thanks for any answers.

JRSweets
Registered User
Posts: 14
Joined: Tue Oct 12, 2004 4:48 pm
Contact:

Re: what does left_id and right_id in the table forums?

Post by JRSweets »

Did you take a look at the code in the acp to add forum and/or modules?

god0fgod
Registered User
Posts: 4
Joined: Sun Jun 24, 2007 3:49 pm

Re: what does left_id and right_id in the table forums?

Post by god0fgod »

I did look but probably not enough. I'll look again tomorrow.

User avatar
the_dan
Registered User
Posts: 700
Joined: Thu Apr 01, 2004 7:36 pm

Re: what does left_id and right_id in the table forums?

Post by the_dan »

The sitepoint article linked above gives details about how the numbers are allocated.

User avatar
Dog Cow
Registered User
Posts: 271
Joined: Wed May 25, 2005 2:14 pm

Re: what does left_id and right_id in the table forums?

Post by Dog Cow »

They're for sub-forums, right? So you know what the parent forum is, and what the child forum is.

This is my assumption, anyway. :?

Post Reply