Пример #1
0
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 private static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new TemplateEngine();
     }
     return self::$instance;
 }
Пример #3
0
 protected function init($name) {
     Logger::enter_group('Template');
     Logger::debug('Loading Template');
     $this->name = $name;
     
     $this->tpl_engine = TemplateEngine::instance();
     $this->tpl_engine->set_opts(array(
         'loader' => array(
             APP_ROOT . "/views/",
             APP_ROOT . "/views/" . $this->name
         ),
         'cache' => Config::instance('framework')->get_value('cache'),
         'debug' => Config::instance('framework')->get_value('debug')
     ));
     $this->tpl_engine->load();
 }
 public static function init($template_dir = null, $compiled_dir = null, $cache_dir = null)
 {
     if (!self::$instance instanceof DwooEngine) {
         if ($template_dir != null) {
             self::$template_dir = $template_dir;
         } else {
             self::$template_dir = realpath(dirname(__FILE__) . '/../templates/');
         }
         self::$instance = new DwooEngine(self::$template_dir);
         if ($cache_dir != null) {
             self::$instance->setCacheDir($cache_dir);
         }
         if ($compiled_dir != null) {
             self::$instance->setCompileDir($compiled_dir);
         }
     }
 }