protected function smartyOutputContent($content) { $this->context->cookie->write(); if (is_array($content)) { foreach ($content as $tpl) { $html = $this->context->smarty->fetch($tpl); } } else { $html = $this->context->smarty->fetch($content); } $html = trim($html); if ($this->controller_type == 'front' && !empty($html)) { $dom_available = extension_loaded('dom') ? true : false; if ($dom_available) { $html = Media::deferInlineScripts($html); } $html = trim(str_replace(array('</body>', '</html>'), '', $html)) . "\n"; $this->context->smarty->assign(array('js_def' => Media::getJsDef(), 'js_files' => array_unique($this->js_files), 'js_inline' => $dom_available ? Media::getInlineScript() : array())); $javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_ . 'javascript.tpl'); echo $html . $javascript . "\t</body>\n</html>"; } else { echo $html; } }
protected function smartyOutputContent($content) { $this->context->cookie->write(); $js_tag = 'js_def'; $this->context->smarty->assign($js_tag, $js_tag); if (is_array($content)) { foreach ($content as $tpl) { $html = $this->context->smarty->fetch($tpl); } } else { $html = $this->context->smarty->fetch($content); } $html = trim($html); if ($this->controller_type == 'front' && !empty($html) && $this->getLayout()) { $live_edit_content = ''; if (!$this->useMobileTheme() && $this->checkLiveEditAccess()) { $live_edit_content = $this->getLiveEditFooter(); } $dom_available = extension_loaded('dom') ? true : false; $defer = (bool) Configuration::get('PS_JS_DEFER'); if ($defer && $dom_available) { $html = Media::deferInlineScripts($html); } $html = trim(str_replace(array('</body>', '</html>'), '', $html)) . "\n"; $this->context->smarty->assign(array($js_tag => Media::getJsDef(), 'js_files' => $defer ? array_unique($this->js_files) : array(), 'js_inline' => $defer && $dom_available ? Media::getInlineScript() : array())); $javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_ . 'javascript.tpl'); echo ($defer ? $html . $javascript : str_replace($js_tag, $javascript, $html)) . $live_edit_content . (!isset($this->ajax) || !$this->ajax ? '</body></html>' : ''); } else { echo $html; } }
/** * Renders controller templates and generates page content * * @param array|string $content Template file(s) to be rendered * @throws Exception * @throws SmartyException */ protected function smartyOutputContent($content) { $this->context->cookie->write(); $html = ''; $js_tag = 'js_def'; $this->context->smarty->assign($js_tag, $js_tag); if (is_array($content)) { foreach ($content as $tpl) { $html .= $this->context->smarty->fetch($tpl, null, $this->getLayout()); } } else { $html = $this->context->smarty->fetch($content, null, $this->getLayout()); } if ($this->controller_type === 'modulefront') { // Modules do not know about the layout system, // let's inject their output inside the front-end layout. $this->context->smarty->assign('content', $html); $html = $this->context->smarty->fetch('wrapper.tpl'); } $html = trim($html); if (in_array($this->controller_type, array('front', 'modulefront')) && !empty($html) && $this->getLayout()) { $dom_available = extension_loaded('dom') ? true : false; $defer = (bool) Configuration::get('PS_JS_DEFER'); if ($defer && $dom_available) { $html = Media::deferInlineScripts($html); } $html = trim(str_replace(array('</body>', '</html>'), '', $html)) . "\n"; $this->context->smarty->assign(array($js_tag => Media::getJsDef(), 'js_files' => $defer ? array_unique($this->js_files) : array(), 'js_inline' => $defer && $dom_available ? Media::getInlineScript() : array())); $javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_ . 'javascript.tpl'); if ($defer) { echo $html . $javascript . (empty($this->ajax) ? '</body></html>' : ''); } else { echo preg_replace('/(?<!\\$)' . $js_tag . '/', $javascript, $html) . (empty($this->ajax) ? '</body></html>' : ''); } } else { echo $html; } }