Magento 页脚缓存解决方案。。什么';这是正确的方法吗?
我在footer.phtml中有以下代码块Magento 页脚缓存解决方案。。什么';这是正确的方法吗?,magento,magento-1.4,Magento,Magento 1.4,我在footer.phtml中有以下代码块 <!-- Customer Modal --> <?php if (array_key_exists("customer_select", $_COOKIE) == FALSE ): ?> <script type="text/javascript" src="<?=$this->getSkinUrl('js/jqModal.js')?>"></script> <
<!-- Customer Modal -->
<?php if (array_key_exists("customer_select", $_COOKIE) == FALSE ): ?>
<script type="text/javascript" src="<?=$this->getSkinUrl('js/jqModal.js')?>"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#customer_type_dialog").jqm().jqmShow();
});
</script>
<?php include("../../templates.eu/templates.sbc.de/_includes/customer_select.php"); ?>
<?php endif; ?>
将上述代码放入其自己的模板文件中,并更改布局:
<reference name="before_body_end">
<block type="core/template" template="your/cookie/check/file.phtml" />
</reference>
这样可以缓存页脚(这有助于保持页面速度),并且每次都会对cookie检查进行评估。另外,Javascript将保留到页面的最后一个可能点,这是内联脚本的最佳实践。我将把布局更改放在哪里?在page.xml中?我应该创建自己的布局文件吗?两者都同样有效,这取决于个人品味。有些人说要经常使用local.xml
,但如果是为您正在编写的模块编写的,那么它应该放在modulename.xml
中。我认为如果你的主题依赖于它,那么直接把它放在page.xml
中是可以接受的。另外,它应该放在
布局句柄内,或者像
这样更具体的页面,或者其他任何东西……我想把语句放在小节中,但它似乎工作正常。