Node type database structure. |
[eluser]CoolGoose[/eluser]
Hi all. I want to do a very basic cms for personal use but i can't seem to get the database structure right (my database relationship skills are low). The "problem" is that i want every item in the database to be like a node. So posts/categories/users/topics whatever should be node items with corresponding options to each. Something like Code: nodes (id, type_id) Does anyone have another idea ? Thanks a lot for your time.
[eluser]m4rw3r[/eluser]
You could have a Page_base class which all the other "special" pages extend. Then in your database, have a column where you store the 'name','id' or 'path to file with class'. Ex. Code: Table for storing pages: Then the class which represents a page have a method called load(), which takes the serialized string and unserializes it and inits all internal data with that data. The class also have a method called something like render(), which returns the page or something you can use in your templates. The Blog_Index_page can then override those methods to make it behave in a special way. This is only a simple example on how it can be done, there are many more ways you can implement different page types.
[eluser]CoolGoose[/eluser]
@Sam Dark: I'm fully aware about Drupal and no i don't intend to make a Drupal clone. Thanks for the heads up though. The problem with Drupal is that it's not a MVC like CMF and i don't really like it. It's great for a CMS and making some sites fast with views / cck & co. @m4rw3r That's a bit too db intensive and it's not just about page types. Sam got it pretty well with the Drupal example. Maybe i should look over the drupal db structure more (Drupal future 7 preferably because it will try to treat all the elements as nodes even comments / signatures). I'm open to more suggestions. Thanks again for your help.
[eluser]Sam Dark[/eluser]
@CoolGoose: MVC is not always good. For example there are some topics here at CI forum (one is mine ) where people are asking how to call Controllers from Views. It's not strict MVC but it's really flexible.
[eluser]CoolGoose[/eluser]
I understand your point of view but let's not turn this into a MVC vs something else debate. After all it's a matter of taste .
[eluser]Sam Dark[/eluser]
OK. My DB variant: Code: //common for all nodes Plus there'll be some node-specific tables.
[eluser]CoolGoose[/eluser]
Thanks for your help. I'll keep you updated about the progress. |
Welcome Guest, Not a member yet? Register Sign In |