SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Adam A Flynn's Avatar
    Join Date
    Jul 2004
    0 Post(s)
    0 Thread(s)

    Designing a CMS Framework - Working with Modules


    I am in the process of developing a CMS framework for a client of mine. I want to start to experiment with shifting my company toward doing website development/consulting and deploying this CMS for clients from strictly doing web application development, so, doing this CMS right from the start will save me a lot of time in the future.

    Basically, on the front-end, the CMS needs a series of "pages" which are a composition of the basic site UI (things like the header, menu, etc) and one or more "modules". These "modules" could be anything from HTML stored in the DB, to a blog, to a calendar, to a forum, to an image gallery, to a link database, etc, etc. All of these components then need back-end administrative control.

    What I'm thinking for a structure is this... MVC pattern with a single dispatcher script. The dispatcher loads the model and sets up the basic UI stuff (probably via a View object), pulls the user data into a $user object, and loads all the UI stuff into the $template object. It calls the necessary Controller and passes the $user and $template objects to it. The Controller handles user access control and loads an error View should the user not have access. The PageController would ask the model for a list of modules associated with the given page, and, from that, it would build a bunch of Controller classes (derived from a common Controller subclass specific to these sorts of modules). These controllers would all deal with any user input specific to the given module (through GET/POST variables), interact with the model as necessary, and then call their respective View classes which would go modify the reference-passed $template object by adding/modifying template components.

    I had considered restricting modules within a page to just a view, and, for some things (like where it's just HTML pulled from a DB table), the Controller will do pretty well nothing but glue the View to the PageController. But, for other modules, there would need to be more interaction with the user input and model, which isn't really appropriate to just put into a View.

    So, is this overdoing it or is a controller within a controller legal? Also, how would I fit admin stuff into all of this? Is it wise to try to encapsulate admin stuff in the same set of view/controller classes (so, if there's a RunUser() then there's also a RunAdmin(), for example), or is that a whole other set of view/controller classes do you think?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2003
    0 Post(s)
    0 Thread(s)
    > So, is this overdoing it or is a controller within a controller legal?

    Of course it's perfectly legal; I use this approach myself, in that you have a parent controller, and said parent controller has child controllers, and it works well; You may find that this approach is used by a number of other members - it's popular


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts