mardi 26 janvier 2016

New to MVC - structure for db driven website with static and article pages

I am creating a website and want to use MVC pattern (for learning experience), but I am struggling with what structure of model / view / controllers would I need in order to achieve this and how should they interact?

  • Website consists of static pages (about, contact, mission statement etc) and "blog" pages (articles).

  • The top navigation will have links to About/Contact/Mission Statement and separate hierarchical lists of Category > Subcategory to get at the "blog" article pages. e.g.

Opinions > Politics, Current Events, The Weather

Reviews > Movies, Music, Art Exhibits

  • Clicking on a subcategory e.g. Reviews > Movies should bring up a list (in a table) of all blog entries with that subcategory with hyperlink

  • Clicking on a link to a specific entry within Reviews > Movies (or whatever) listing page should go to a detail page with the title, author, date, content etc.

  • Articles are made up of "sections" each with its own header. An article can have 1 or more sections.

  • Articles will be stored in a database (mysql)

Database structure I have so far is: Category (id, name) Subcategory (id, name, CategoryID FK) Article (id, name, date written, author ........ SubCategoryID FK)

I am not sure how to fit "ArticleList" and "Article" together in a controller or what to put for the model for each.

Aucun commentaire:

Enregistrer un commentaire