Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMS design patterns and considerations

I am creating the cms for a relatively simple site - portfolio, some general content pages, custom blog etc.

What are some of the best patterns to consider before diving into the design.

I want the system to be as flexible as possible without being too complex.

I have looked for some good resources that discus cms and blog design but can't find anything too good.

My language is php but I suppose I am looking for more language independent advice.

like image 682
David Avatar asked Jan 10 '11 20:01

David


2 Answers

Flexibility without complexity... nice program.

Maybe you're a genius and you will make something that feet your needs. But I think the biggest problem you will face is security and robustness. So really, take other advices on this page and have a look at wordpress, drupal, joomla and ezpublish. A lot of security stuff is already done. And not only security...

So, study some of these tools, track their flaws, check their security policy. Study how they handle caching, sessions, bootstrap, absolute & relative url managment, documents (images, videos, etc), ajax, authentification, identification, acl, user interfaces, rich-text editing, migrations, templating, page composition, content filtering (I try to remove the things you won't need, plugins, database abstraction, fine caching, css and js minification, all the extra-complex stuff not needed for a single instance simple CMS). Soon you'll have a 'picture' of the stuff they've done.

By doing this work, you'll certainly notice some big differences, and mistakes. You'll start going on irc and flaming developpers, telling them that others have done better choices. You'll start forgetting to shave. You'll maybe do some contributions. Some will be accepted, others won't. Old core devs doesn't like when someone explain why they made mistakes (and they make mistakes).

Now, comes the day you have a beard. Some of your contributions will start looking like forks. You will have ennemies, and friends, or followers. And you will start feeling the force.

And you will go on irc and tell god that the world is ugly and that you'll make the first CMS which will be flexible without being complex. And people will cry. And birds will run in circles. And you will be able to explain what are the design pattern of a CMS.

  • I am a user. I know what I want. Doing what I want will make user happy. I'm happy.
  • You shall not trust code from people with glasses
  • "MVC MVC MVC" : and the people responds 'that shall be done'

Seriously, There's still a place for a good CMS with disruptive innovation, the fork history has started long time ago with phpNuke (as far as I can remember). But some of the actual products are really fine for most tasks.

like image 70
regilero Avatar answered Oct 31 '22 14:10

regilero


I'm probably risking the reputation here, but my experience shows that building your own CMS can be a very justified decision, especially when you get familiar with current opensource systems and understand what exactly they lack in terms of features, security or what not. Open-source often means a lot of backward-compatibility concerns and bad architecture decisions that cannot be easily changed.

I strongly suggest that instead of just taking on MVC you take a look at ideas that make it attractive.

One main problem with CMSes is the range of technologies involved in driving dynamic web-sites: imperative php for logic, declarative SQL for data queries, markup HTML for interface, imperative/functional javascript for dynamic interface, JSON for ajax calls etc. To keep the system manageable you have to keep these technologies in a controlled and understandable environment, but yet allow for smooth integration. Knowledge and best practices are out there. MVC is but one approach to manage this problem.

My choice at the time was to use the following principles:

  • Object-oriented code with static calling (php is a one-run thing, many instances of code objects are rarely justified), nothing except for one line of init code in global context
  • 100% code-design separation with the use of XSLT and custom content processor
  • Custom router that can take any http request and reroute it to registered methods
  • Custom content processor that can take arbitrary method output and convert it into any usable format such as xhtml, xml, json etc. based on the request parameters (i.e. http://local/class/method.xhtml, http://local/class/method.json)
  • One copy of code for as many virtual web servers as necessary
  • SQL query builder (chosen for flexibility over ORM) for all database queries
  • Mandatory filtering of method input with filter_* functions

I believe you can choose a few that you like :) And good luck!

like image 4
Dennis Kreminsky Avatar answered Oct 31 '22 12:10

Dennis Kreminsky