MVC Feature

MVC is Model, View, Controller design pattern. The controller is page controller and this proposal will give the technical details on how it may possibility be implemented.

The MVC files will be located underneath the public domain and the main public web directory should only have one index and a folder for the images and web files. This will also allow for multiple game arenas for separating different features, but keeping the same Model

The Page Controller

The Page Controller will be simple and check for the directory and page structure. This will allow for error checking, because if neither the page nor directory is found, then a 404 HTTP error will be thrown. It will also speed things up since the logic will take less lines. New pages can easily be reordered and created, speeding up the development.

The logic will first check for the file for the last element. If it isn’t found and a directory exists instead, the default page will be loaded instead. If neither exist then a 404 HTTP error will be thrown.

The entire page controller will be contained in the main index.php file in the main public directory. The Page Controller files will be located elsewhere.

The Page Controller files will not contain any HTML and only instance the required classes, functions, and whatever.

View — PHP/HTML Pages

The HTML files will not use Smarty or Template Lite and will use plain PHP tags for the “Templating” in the view files. A templating engine will be used to replace the View PHP variables after the logic has completed.

This will alllow further separation of the page and view files, so that the logic will be contained in the controller pages, instead of in the View files.

Model — Templating

Direct manipulation of the PHP variables is quicker than using templating even with page caching. Also, caching can be done on the Page side where possible for sections that need them, instead of entire pages or page sections.

Caching will be done for data that won’t change very often. It will only store the serialized data and not the HTML resulting data. There already exists classes that handle this type of caching and they will be used instead of page caching, which would have to be done in sections anyway given the dynamic nature of the web site.

Usage In Gamehole!

When I go back to Gamehole project, this is one of the features that I plan to use to speed the site up, as well as offer greater expansion capabilities.

I don’t plan on using this type of MVC and will probably switch over to either Zend Framework, or another framework that offers MVC. The only projects that will use this setup is Gamehole and Battle Machines.

Possibly Related Posts:


Comments are closed.