Framework Skeleton: Setting STDOUT Views

STDOUT MVC API views are programmable application components designed to output content following page requests.

How are they set?

Lucinda Framework lets pure static response components (css, js, images) to be handled by webserver directly (in order to maximize performance), while taking full responsibility in outputting programmable response components aka "views". In Lucinda, views can be:

How are they compiled?

Regardless of whether or not views are set by files or output stream, before being displayed they need to be compiled of any PHP logic inside, which needs to be converted to language page is supposed to be displayed with (eg: HTML). STDOUT MVC API expects this to be done by Lucinda\MVC\STDOUT\ViewResolver instances located based on value of "class" attribute of <format> XML tag matching response content type.

Compilation outcome is feeding output buffer with response to be displayed. Response isn't immediately displayed, however, because optional Lucinda\MVC\STDOUT\ResponseListener instances ran after compilation has ended must be able to alter it.

Lucinda implements following compilers:

Compiler Format Description
HtmlResolver html Compiles views in HTML format using PHP templating.
ViewLanguageResolver html Compiles views in HTML format using ViewLanguage templating.
JsonResolver json Compiles views in JSON format.

How are they displayed?

Once a view is compiled and its body is saved to output stream, the only step left is to display stream back to caller along with appropriate headers. Appropriate response headers are detected based on:

HTTP status code of response is always 200 OK by default. When Lucinda\MVC\STDOUT\Controller or Lucinda\MVC\STDOUT\ResponseListener instances need to set another status:


If only a redirection is needed:

$this->response->redirect(URL, IS_PERMANENT=true, NO_CACHE=false);

Once everything is done, Lucinda\MVC\STDOUT\FrontController calls commit method of Lucinda\MVC\STDOUT\Response instance to finally output content back to caller.