Originally Posted by Fou-Lu
This indicates that you'll need to use recursion (or a hellalot of querying within the recursion, which I don't recommend); alternatively in the OO world you could write a tree. I don't recommend writing it to match just the two levels if there is a possibility the depth will change (otherwise you could actually query it in a way that it builds the lists into a logical array with minimal PHP work, but it is tied down whatever level you query). Too bad RDBMS aren't recursive.
I'll try to write something up between work here today. The type column isn't necessary btw, I'll assume that a parent_page of either 0 or null would dictate whether it is located on top or not (I'll assume 0). Either case I'll typically create a root parent anyway since it makes the recursion easier.
BTW, what is this page content here? Is it actually a text type or something more along a title? You want to try and minimize the data per fetch if you can.
Wow - I hadn't realised it would be quite so complex! I had no idea there would be OO or recursion required, but any pointers you could give me would be wonderful!
To answer your question, the page content will simply be html code (edited via a text-box / ckeditor tool). Also, the TYPE field is required, as the database is also used for a number of other record types, of which TOP_PAGE or SUB_PAGE are just a couple of types.