gevans Posted September 10, 2009 Share Posted September 10, 2009 Hey guys, I've done a similar database to this before, but I think I over complicate things. I'm trying to think of the cleanest way to do this, wanted to see what you guys think... The website has a 3 level hierachy, and example would be; home -> who we are -> history Each of these pages will have it's own content (also stored in the database). My first thought was to only use two tables... `pages` and `content`. `content` would be easy, with the page's id assigned to it. For `pages` I was going to put an extra couple of id fields in it; `id` - referenced by `content` `title` - usual stuff `level` - an integer to represent the hierachical level of the page (2 for the first sub nav) `order` - for ordering pages `parent` - parent id, or NULL if its top of the hierachy Am I missing something, or is there a better way of doing this? Cheers, gevans Quote Link to comment https://forums.phpfreaks.com/topic/173808-how-to-structure-this-database/ Share on other sites More sharing options...
gevans Posted September 11, 2009 Author Share Posted September 11, 2009 I'm gonna leave this another day. If I get no feedback I'll assume that my way is OK... Cheers Quote Link to comment https://forums.phpfreaks.com/topic/173808-how-to-structure-this-database/#findComment-916618 Share on other sites More sharing options...
fenway Posted September 12, 2009 Share Posted September 12, 2009 As long as the depth is fixed, this approach will work just fine for most cases. Quote Link to comment https://forums.phpfreaks.com/topic/173808-how-to-structure-this-database/#findComment-917352 Share on other sites More sharing options...
gevans Posted September 13, 2009 Author Share Posted September 13, 2009 Thanks fenway, yes the depth is fixed. The site will never have more thatn a depth of 3 page in its hierachy. Cheers again, Gareth Quote Link to comment https://forums.phpfreaks.com/topic/173808-how-to-structure-this-database/#findComment-917695 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.