在 prestashop 中将 CSS 资源从页眉移动到页脚
Move CSS resources from head to footer in prestashop
我想从 <head>
中删除所有 CSS(和 JS)资源到 Prestashop 中的页脚。但我无法弄清楚,即使经过大量实验也是如此。每次我改变一些东西都是意想不到的结果。
我尝试在 类 中编辑 FrontController.php 中的 displayHeader()
和 displayFooter()
,以及 [=16= 中的 header.tpl
和 footer.tpl
]文件夹。
我想我想不出正确的方法。我也试过谷歌搜索。有帮助吗?
注意:我只有 FTP 访问文件的权限。
在 PS 1.6 中,您已经可以在 "Advanced Parameters -> Performance"
中使用此选项在末尾移动 JS
如果您想移动 CSS,您可以将此代码从 /themes/your-theme/header.tpl 移动到 footer.tpl:
{if isset($css_files)}
{foreach from=$css_files key=css_uri item=media}
{if $css_uri == 'lteIE9'}
<!--[if lte IE 9]>
{foreach from=$css_files[$css_uri] key=css_uriie9 item=mediaie9}
<link rel="stylesheet" href="{$css_uriie9|escape:'html':'UTF-8'}" type="text/css" media="{$mediaie9|escape:'html':'UTF-8'}" />
{/foreach}
<![endif]-->
{else}
<link rel="stylesheet" href="{$css_uri|escape:'html':'UTF-8'}" type="text/css" media="{$media|escape:'html':'UTF-8'}" />
{/if}
{/foreach}
{/if}
我想从 <head>
中删除所有 CSS(和 JS)资源到 Prestashop 中的页脚。但我无法弄清楚,即使经过大量实验也是如此。每次我改变一些东西都是意想不到的结果。
我尝试在 类 中编辑 FrontController.php 中的 displayHeader()
和 displayFooter()
,以及 [=16= 中的 header.tpl
和 footer.tpl
]文件夹。
我想我想不出正确的方法。我也试过谷歌搜索。有帮助吗?
注意:我只有 FTP 访问文件的权限。
在 PS 1.6 中,您已经可以在 "Advanced Parameters -> Performance"
中使用此选项在末尾移动 JS如果您想移动 CSS,您可以将此代码从 /themes/your-theme/header.tpl 移动到 footer.tpl:
{if isset($css_files)}
{foreach from=$css_files key=css_uri item=media}
{if $css_uri == 'lteIE9'}
<!--[if lte IE 9]>
{foreach from=$css_files[$css_uri] key=css_uriie9 item=mediaie9}
<link rel="stylesheet" href="{$css_uriie9|escape:'html':'UTF-8'}" type="text/css" media="{$mediaie9|escape:'html':'UTF-8'}" />
{/foreach}
<![endif]-->
{else}
<link rel="stylesheet" href="{$css_uri|escape:'html':'UTF-8'}" type="text/css" media="{$media|escape:'html':'UTF-8'}" />
{/if}
{/foreach}
{/if}