Frage

So I have a highly customized CMS type system where users can manage content on pages. For the most part everything is templatized, however, the home page is unique in so much that it has additional, editable content that a regular page does not have.

The two solutions that I thought of for this are:

1) I could add a new model, controller, and table in the DB making this an entirely new component. However that seems like a lot of trouble to go through for one page.

2) I could add the missing columns for the home page to the general "pages" table, but again that seems sub-optimal as the additional columns would only ever be used for home page.

What's the best way of handling a situation like this? Is there an additional way that I haven't thought of?

War es hilfreich?

Lösung 2

I ended up just creating a Model, Controller, table, etc. for generic 1-off pages that are flexible as I suspect that I'll have need for additional stand alone pages in the future. The home page is just one of those now with a special route a method in the controller.

Andere Tipps

IMHO it really depends on the site and how much differs b/n the homepage and other pages as well as what DB-interaction the homepage has. Kind of a tough question to answer generally.

One thing I've done in the past that has worked well is to have a "Home" record in the CMS tool (assuming there's a 'content' field you can access). Then build that custom controller/view for the homepage -- it is the homepage after all.

Add in your custom functionality, custom layout, formatting, etc. And pull that 'content' field from the 'Home' record in the CMS and insert it where relevant.

That way, the CMS staff can still tweak the homepage messaging, but you maintain full db-interactivity over it.

Hope that makes sense.

I wouldn't advise against #2. Seems wasteful.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top