UniteIT two point ohh

UniteIT as we know it looks and feels ohh so clean, but in reality the code is rather weird. Most of this comes down to the fact that:

As a result of this there a redundant code, and code with weird tweaks and faults. This is hell to work with, both maintenance and further development.

Therefor Riversen and I have - rather dictatorially - decided that we need a pretty much full rewrite. In order to reduce quirks in the code I think we will go with my Object/ObjectHandler code and Smarty templates. I will post more info on my O/OH framework, as it really is quite nifty and I might just open source it. Regarding the Smarty implementation I made a “Template” wrapper for it and Singleton’ed it.. That resulted in something like:

require_once(DOCROOT . '/include/smarty/Smarty.class.php');

class Template extends Smarty {
  static private $instance = false;

  private function __construct() {
    $this->Smarty();
    $this->caching = true;
  }

  static function instance() {
    if(!Template::$instance) {
      Template::$instance = new Template();
    }
    return Template::$instance;
  }
}

That way you can always do Template::instance()->assign(’var’, ‘value’); which I find rather nifty - we like PHP5 OOP..
Update (2007) Okay, I know now that it really isn’t the smartest way. Go look at Pundit instead.

I will report back on our progress later. We might introduce some new features and you know where to find out where - that’s right, right here!

-fangel

January 14th, 2006 | UniteIT

No comments

Post comment