当前位置: 首页>>代码示例>>PHP>>正文


PHP Media::getJsDef方法代码示例

本文整理汇总了PHP中Media::getJsDef方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getJsDef方法的具体用法?PHP Media::getJsDef怎么用?PHP Media::getJsDef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Media的用法示例。


在下文中一共展示了Media::getJsDef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smartyOutputContent

 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;
     }
 }
开发者ID:carloslastresDev,项目名称:HealthyTaiwan_UsingPrestaShop,代码行数:31,代码来源:Controller.php

示例2: smartyOutputContent

 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;
     }
 }
开发者ID:gks-stage,项目名称:prestashop,代码行数:24,代码来源:Controller.php

示例3: display

 public function display()
 {
     $this->context->smarty->assign(array('display_header' => $this->display_header, 'display_footer' => $this->display_footer, 'js_def' => Media::getJsDef()));
     // Use page title from meta_title if it has been set else from the breadcrumbs array
     if (!$this->meta_title) {
         $this->meta_title = strip_tags(is_array($this->toolbar_title) ? implode(' ' . Configuration::get('PS_NAVIGATION_PIPE') . ' ', $this->toolbar_title) : $this->toolbar_title);
     }
     $this->context->smarty->assign('meta_title', $this->meta_title);
     $template_dirs = $this->context->smarty->getTemplateDir();
     // Check if header/footer have been overriden
     $dir = $this->context->smarty->getTemplateDir(0) . 'controllers' . DIRECTORY_SEPARATOR . trim($this->override_folder, '\\/') . DIRECTORY_SEPARATOR;
     $module_list_dir = $this->context->smarty->getTemplateDir(0) . 'helpers' . DIRECTORY_SEPARATOR . 'modules_list' . DIRECTORY_SEPARATOR;
     $header_tpl = file_exists($dir . 'header.tpl') ? $dir . 'header.tpl' : 'header.tpl';
     $page_header_toolbar = file_exists($dir . 'page_header_toolbar.tpl') ? $dir . 'page_header_toolbar.tpl' : 'page_header_toolbar.tpl';
     $footer_tpl = file_exists($dir . 'footer.tpl') ? $dir . 'footer.tpl' : 'footer.tpl';
     $modal_module_list = file_exists($module_list_dir . 'modal.tpl') ? $module_list_dir . 'modal.tpl' : 'modal.tpl';
     $tpl_action = $this->tpl_folder . $this->display . '.tpl';
     // Check if action template has been overriden
     foreach ($template_dirs as $template_dir) {
         if (file_exists($template_dir . DIRECTORY_SEPARATOR . $tpl_action) && $this->display != 'view' && $this->display != 'options') {
             if (method_exists($this, $this->display . Tools::toCamelCase($this->className))) {
                 $this->{$this->display . Tools::toCamelCase($this->className)}();
             }
             $this->context->smarty->assign('content', $this->context->smarty->fetch($tpl_action));
             break;
         }
     }
     if (!$this->ajax) {
         $template = $this->createTemplate($this->template);
         $page = $template->fetch();
     } else {
         $page = $this->content;
     }
     if ($conf = Tools::getValue('conf')) {
         $this->context->smarty->assign('conf', $this->json ? Tools::jsonEncode($this->_conf[(int) $conf]) : $this->_conf[(int) $conf]);
     }
     foreach (array('errors', 'warnings', 'informations', 'confirmations') as $type) {
         if (!is_array($this->{$type})) {
             $this->{$type} = (array) $this->{$type};
         }
         $this->context->smarty->assign($type, $this->json ? Tools::jsonEncode(array_unique($this->{$type})) : array_unique($this->{$type}));
     }
     if ($this->show_page_header_toolbar && !$this->lite_display) {
         $this->context->smarty->assign(array('page_header_toolbar' => $this->context->smarty->fetch($page_header_toolbar), 'modal_module_list' => $this->context->smarty->fetch($modal_module_list)));
     }
     $this->context->smarty->assign(array('page' => $this->json ? Tools::jsonEncode($page) : $page, 'header' => $this->context->smarty->fetch($header_tpl), 'footer' => $this->context->smarty->fetch($footer_tpl)));
     $this->smartyOutputContent($this->layout);
 }
开发者ID:ramzzes52,项目名称:Uni3,代码行数:48,代码来源:AdminController.php

示例4: smartyOutputContent

 /**
  * 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;
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:45,代码来源:Controller.php


注:本文中的Media::getJsDef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。