LightVC

On the back end, I'm using LightVC to handle the VC part of my MVC setup. LightVC is a wonderfully simple Controller / View setup that is easy to extend for simple custom websites like mine.

About my Setup

So far I have only found the need to have one custom class in the LightVC setup (I have other classes, but this is one that modifies the behavior of LVC itself.)

  • MyAppController extends AppController
    • setTitle($title) New - Helper method to easily set the page title.
    • requireJs($jsFile) Override
    • requireJsInHead($jsFile) Override
    • requireCss($jsFile) Override
    • The previous 3 over rides all now take a string or an array of strings and do exactly what you'd expect, acting like normal if a string is passed, and when an array is passed, iterating over the it and adding the files to the stack.

These were just minor changes to the AppController I wanted to make, modifying their behaviour to suit my coding syle:

$this->requireCss(Array(
   '/lib/game/game.css',
   '/lib/game/hiscore.css',
));

or, as is the case with the games on the site, where I maintain an array of them, each being a hash of information about each game, including the CSS & JavaScript files required to run the game:

$this->requireCss($game['css']);
$this->requireJsInHead($game['js']);

Now that I think about it, I want to modify that class and do 2 things:

  1. Make requireJs act like requireJsInHead, and create a new requireJsInBody method to handle that (which I really try to never do.)
  2. Have all of those methods return the $this object for chaining.