imc blueprint techmeet world

CMSProducer

From techmeet

Jump to: navigation, search

Contents

Implementing a static file Producer Into different CMS/Frameworks

Intro

The static file producer is a concept developed by the Mir Coders, to fit the need for a very resource friendly content distribution.

Producer Features

Here are some basic features of a producer. We try to add these functions to another CMS.

  • The producer is creating a static presentation of a specific part of the website (articles, images, start page, archive page)
  • The producer is able to create pieces of a website (only the newswire or only the comments etc pp)

Producer Basics

Here are some basics to keep in mind

  • In the MVC model, the producer is the controller
  • To be more exact, the producers.xml, the producer configuration file, is the controller and the producer itself is the dispatcher (sometimes called the request handler)
  • The producer does not work based on a user request
  • The producer is not a cache. All cache system out there are request based, they will NOT work as a producer.

Implementation

The main problem with implementation of a producer into a normal CMS, is the request based structure

  • Usually the user request is passed through a request handler
  • The controller is called, all the needed data is acquired and handed over to the view
  • The View is calling the template system to render the page
  • The finished page will either be printed out to the user directly from the view object, or
  • the finished page is handed back to the request handler for caching and output

Possible Solution #1

A very easy solution is the simulation of a user request

  • Find the dispatcher / request handler of the CMS
  • Recreate the dispatcher as a external module
  • Call the dispatcher with the specific url and save the generated page into a static file.

CakePHP Exmaple

Here a small Proof on Concept in CakePHP.

In CakePHP we have a the follwing structure of a request

  • Index.php / Bootstrap / Router are doing the basic setup of the site
  • Call of the dispatcher with the url
  • Dispatcher is calling the controller based on the url
  • Dispatcher hands over the controller to the view
  • View is calling the Template with all the data etc...
  • View is printing out the page

So...

  • We move all the logic from the producers.xml into the CakePHP controllers (article controller with view function)
  • We simulate the a user request by calling the dispatcher with a url
  • bootstrap.php includes all the needed classes to have the dispather avalibale
  • producer.php creates and calls the dispatcher

Problems

Only the generation of the hole page is possible.

  • If you have a CMS where you can separate the page into pieces, you only can merge these modules together on the view level, that means, inside the templates.
  • Very often you can not request the content of a piece from the controller
  • If you can request the the content of the page from the controller, it is usually the hole page as string

Possible Solutions #2

yeah, well, have a deep dive down into some CMS code and tell us.