public function output() { if ($this->hasErrors()) { return false; } $this->_httpHeaders['Content-Type'] = 'text/xml;charset=' . $GLOBALS['gJConfig']->charset; $this->sendHttpHeaders(); echo '<?xml version="1.0" encoding="' . $GLOBALS['gJConfig']->charset . '"?>'; $this->prologSent = true; if ($this->template != '') { $tpl = new jTpl(); $tpl->assign('data', $this->data); $tpl->display($this->template); } else { $this->generateContent(); } return true; }
protected function showMainTemplate($page, $content, $continue) { $filename = "wiz_layout.tpl"; $path = $this->getRealPath('', $filename); jTplConfig::$templatePath = dirname($path) . '/'; $this->loadLocales('', 'wiz_layout'); $conf = $this->config[$this->stepName . '.step']; $tpl = new jTpl(); $tpl->assign('title', $page->getLocale($page->title)); if (isset($conf['messageHeader'])) { $tpl->assign('messageHeader', $conf['messageHeader']); } else { $tpl->assign('messageHeader', ''); } if (isset($conf['messageFooter'])) { $tpl->assign('messageFooter', $conf['messageFooter']); } else { $tpl->assign('messageFooter', ''); } $tpl->assign('MAIN', $content); $tpl->assign(array_merge(array('enctype' => ''), $conf)); $tpl->assign('stepname', $this->stepName); $tpl->assign('lang', $this->lang); $tpl->assign('next', $continue && isset($conf['next'])); $tpl->assign('previous', isset($conf['__previous']) ? $conf['__previous'] : ''); $tpl->assign('appname', isset($this->config['appname']) ? $this->config['appname'] : 'Application'); $tpl->display($filename, 'html'); }
<?php error_reporting(E_ALL); include '../jtpl_standalone_prepend.php'; jTplConfig::$cachePath = dirname(__FILE__) . '/../temp/'; jTplConfig::$templatePath = dirname(__FILE__) . '/'; $tpl = new jTpl(); $countries = array('France', 'Italie', 'Espagne', 'Belgique'); $tpl->assign('countries', $countries); $tpl->assign('titre', 'This is a test !'); $tpl->display('test.tpl'); $tpl = new jTpl(); $tpl->assign('titre', 'This is an other test !'); $tpl->display('foo/test.tpl');
/** * generate the xul content. * @return boolean true if it's ok */ public function output() { $this->_headSent = false; $this->_httpHeaders['Content-Type'] = 'application/vnd.mozilla.xul+xml;charset=' . $GLOBALS['gJConfig']->charset; $this->sendHttpHeaders(); $this->doAfterActions(); if ($this->bodyTpl != '') { $this->body->meta($this->bodyTpl); } $this->outputHeader(); $this->_headSent = true; echo implode('', $this->_bodyTop); if ($this->bodyTpl != '') { $this->body->display($this->bodyTpl); } if ($this->hasErrors()) { if ($GLOBALS['gJConfig']->error_handling['showInFirebug']) { echo '<script type="text/javascript">if(console){'; foreach ($GLOBALS['gJCoord']->errorMessages as $e) { switch ($e[0]) { case 'warning': echo 'console.warn("[warning '; break; case 'notice': echo 'console.info("[notice '; break; case 'strict': echo 'console.info("[strict '; break; case 'error': echo 'console.error("[error '; break; } echo $e[1], '] ', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $e[2]), ' (', str_replace('\\', '\\\\', $e[3]), ' ', $e[4], ')");'; } echo '}else{alert("there are some errors, you should activate Firebug to see them");}</script>'; } else { echo '<vbox id="jelixerror" style="border:3px solid red; background-color:#f39999;color:black;">'; echo $this->getFormatedErrorMsg(); echo '</vbox>'; } } echo implode('', $this->_bodyBottom); if (count($GLOBALS['gJCoord']->logMessages)) { if (count($GLOBALS['gJCoord']->logMessages['response'])) { echo '<vbox id="jelixlog">'; foreach ($GLOBALS['gJCoord']->logMessages['response'] as $m) { echo '<description>', htmlspecialchars($m), '</description>'; } echo '</vbox>'; } if (count($GLOBALS['gJCoord']->logMessages['firebug'])) { echo '<script type="text/javascript">if(console){'; foreach ($GLOBALS['gJCoord']->logMessages['firebug'] as $m) { echo 'console.debug("', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $m), '");'; } echo '}else{alert("there are log messages, you should activate Firebug to see them");}</script>'; } } echo '</', $this->_root, '>'; return true; }
/** * output the html content * * @return boolean true if the generated content is ok */ public final function output() { $this->_headSent = 0; if ($this->_isXhtml && $this->xhtmlContentType && strstr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) { $this->_httpHeaders['Content-Type'] = 'application/xhtml+xml;charset=' . $this->_charset; } else { $this->_httpHeaders['Content-Type'] = 'text/html;charset=' . $this->_charset; } $this->sendHttpHeaders(); $this->outputDoctype(); $this->_headSent = 1; $this->doAfterActions(); if ($this->bodyTpl != '') { $this->body->meta($this->bodyTpl); } $this->outputHtmlHeader(); echo '<body '; foreach ($this->bodyTagAttributes as $attr => $value) { echo $attr, '="', htmlspecialchars($value), '" '; } echo ">\n"; $this->_headSent = 2; echo implode("\n", $this->_bodyTop); if ($this->bodyTpl != '') { $this->body->display($this->bodyTpl); } if ($this->hasErrors()) { if ($GLOBALS['gJConfig']->error_handling['showInFirebug']) { echo '<script type="text/javascript">if(console){'; foreach ($GLOBALS['gJCoord']->errorMessages as $e) { switch ($e[0]) { case 'warning': echo 'console.warn("[warning '; break; case 'notice': echo 'console.info("[notice '; break; case 'strict': echo 'console.info("[strict '; break; case 'error': echo 'console.error("[error '; break; } echo $e[1], '] ', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $e[2]), ' (', str_replace('\\', '\\\\', $e[3]), ' ', $e[4], ')");'; } echo '}else{alert("there are some errors, you should activate Firebug to see them");}</script>'; } else { echo '<div id="jelixerror" style="position:absolute;left:0px;top:0px;border:3px solid red; background-color:#f39999;color:black;">'; echo $this->getFormatedErrorMsg(); echo '<p><a href="#" onclick="document.getElementById(\'jelixerror\').style.display=\'none\';return false;">fermer</a></p></div>'; } } echo implode("\n", $this->_bodyBottom); if (count($GLOBALS['gJCoord']->logMessages)) { if (count($GLOBALS['gJCoord']->logMessages['response'])) { echo '<ul id="jelixlog">'; foreach ($GLOBALS['gJCoord']->logMessages['response'] as $m) { echo '<li>', htmlspecialchars($m), '</li>'; } echo '</ul>'; } if (count($GLOBALS['gJCoord']->logMessages['firebug'])) { echo '<script type="text/javascript">if(console){'; foreach ($GLOBALS['gJCoord']->logMessages['firebug'] as $m) { echo 'console.debug("', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $m), '");'; } echo '}else{alert("there are log messages, you should activate Firebug to see them");}</script>'; } } echo '</body></html>'; return true; }