function &createTemplate($option, $isAdmin = false, $useCache = false) { global $mainframe; $bodyHtml = ''; $files = null; jimport('joomla.template.template'); $tmpl = new JTemplate(); // load the wrapper and common templates $tmpl->readTemplatesFromFile('page.html'); $tmpl->applyInputFilter('ShortModifiers'); // load the stock templates if (is_array($files)) { foreach ($files as $file) { $tmpl->readTemplatesFromInput($file); } } // TODO: Do the protocol better $tmpl->addVar('form', 'formAction', basename(str_replace(array('"', '<', '>', "'"), '', $_SERVER["PHP_SELF"]))); $tmpl->addVar('form', 'formName', 'adminForm'); $tmpl->setRoot(dirname(__FILE__) . '/tmpl'); $tmpl->setNamespace('mos'); if ($bodyHtml) { $tmpl->setAttribute('body', 'src', $bodyHtml); } return $tmpl; }