/** * Handles creating hte I2CE_TemplateMeister templates and loading any default templates * @returns boolean true on success */ protected function initializeTemplate() { if (array_key_exists('defaultHTMLFile', $this->args) && $this->args['defaultHTMLFile']) { $this->defaultHTMLFile = $this->args['defaultHTMLFile']; } else { $this->defaultHTMLFile = false; } if (!isset($this->args['templates'])) { $this->args['templates'] = array(''); } if (is_scalar($this->args['templates'])) { $this->args['templates'] = array($this->args['templates']); } if (isset($this->args['template'])) { $template = $this->args['template']; } else { $template = 'I2CE_Template'; } $this->template = new $template(); if (!$this->template instanceof I2CE_TemplateMeister) { I2CE::raiseError("Could not make template {$template}"); return false; } $this->template->setUser($this->user); if (array_key_exists(0, $this->args['templates']) && $this->args['templates'][0]) { $this->template->loadRootFile($this->args['templates'][0]); } else { $this->template->loadRootText(''); } for ($i = 1; $i < count($this->args['templates']); $i++) { $this->template->addFile($this->args['templates'][$i]); } $this->template->processArgs($this->args); return true; }