Minimal BDD CMS with PHP and PHPSpec Part III: A High Level View

I will describe here the high level view for our first components. A Template Engine, an ORM and some auxiliary classes.

The needs

So, lets imagine that we start with the simplest case. Our CMS must present a welcome page. Our PHP application must catch the URI, parse it, and dispatch the request to a specific Controller that speaks with the Model and renders HTML.

The libs

It will be desirable to have a template directory system, allowing us to create widgets that can be site-wide or post-specific, also we want themes and skins,  and separated .js and .css content. The themes can also have specific widgets. The widgets are Views, and can interact with the Model through its Controllers.

We need also that the Views of the CMS could be designed by persons with minimal HTML know-how ;)

So we’ll need a template engine to manage the View part of the CMS. It must render HTML and its variables must be passed to/from Controllers interacting with the Model. It must be simple … it must be fast … and it must be furious .. so I choose RainTPL.

The model and database iteration will be defined by Doctrine 2.1 Entities. The Doctrine ORM It’s great, a little messy to setup but works very very very well :) Compared with NHibernate, they are very similar in features.

A logging system, log4php is the library that we need.

Our new components

So, we’ll store the Views as RainTPL Templates, the Controllers as PHP scripts interacting with the Doctrine models. Also we’ll use a code-first approach. The database will be generated from our models, I’ll explain more on this on another post.

We can foresee that we will need to develop the following core components:

  • An URI parser, it must obtain the adecuate context variables from the GET/POST that goes to the user’s browser and expose them in a simple way to process them.
  • A router/dispatcher that instantiates the adecuate Controller to render the specific View
  • The controller’s core to talk with the models and draw the View through the Template Engine.

The architecture will be similar to the Onion architecture, but with some transversal objects, for example, the logging system.

The project is at http://redmine.tao.homeunix.net/projects/bddphpcms

So we’ll setup the project at the next step.

See you in part III

2 thoughts on “Minimal BDD CMS with PHP and PHPSpec Part III: A High Level View

  1. Pingback: Manu º¹ºº¹¹º¹º¹¹¨¨

Leave a Reply to the best e cigarette Cancel reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>