我的自定义CMS布局模板未在Magento中加载 [英] My custom CMS Layout Template in Magento is not loaded
问题描述
我已根据本教程.在我的本地主机(Win7上的XAMPP)上,它可以工作,但是当我将所有3个文件上传到我的网站时:
- app/code/local/Lorinc/cmsLayout/etc/config.xml
- app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
- app/etc/modules/Lorinc_cmsLayout.xml
它在那里不起作用. 这是 config.xml
的代码<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<version>0.1.0</version>
</Lorinc_cmsLayout>
</modules>
<global>
<page>
<layouts>
<cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
这是 Lorinc_cmsLayout.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Lorinc_cmsLayout>
</modules>
</config>
我已经尝试了一切.我更改了文件和文件夹权限(文件0644,文件夹0755),我使用了 magento-cleanup .php ,我的缓存已禁用,我尝试注销并再次登录,但无济于事.有什么想法哪里有问题吗?
问题终于解决了.我在该页面上已经有一个自定义布局(称为HomeLayout),所以我只合并了这2个布局.这是app/code/local/Lorinc/HomeLayout/etc/config.xml的代码
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_HomeLayout>
<version>0.1.0</version>
</Lorinc_HomeLayout>
</modules>
<global>
<page>
<layouts>
<Lorinc_HomeLayout translate="label">
<label>HomeLayout</label>
<template>page/HomeLayout.phtml</template>
<layout_handle>HomeLayout</layout_handle>
</Lorinc_HomeLayout>
<Lorinc_cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</Lorinc_cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
而且效果很好.
I have created custom CMS layout for Magento according this tutorial. On my localhost(XAMPP on Win7) it is working, but when I have uploaded all 3 files to my web:
- app/code/local/Lorinc/cmsLayout/etc/config.xml
- app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
- app/etc/modules/Lorinc_cmsLayout.xml
And it is not working there. Here is the code of config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<version>0.1.0</version>
</Lorinc_cmsLayout>
</modules>
<global>
<page>
<layouts>
<cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And here is Lorinc_cmsLayout.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Lorinc_cmsLayout>
</modules>
</config>
I have tried everything. I have changed files and folder permissions (files 0644, folders 0755), i have used magento-cleanup.php, my cache is disabled, I have tried to logout and login again and nothing works. Any ideas what is wrong there?
Problem finally solved. I already had one custom layout (called HomeLayout) on that page so I just merged that 2 layouts. Here is the code of app/code/local/Lorinc/HomeLayout/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_HomeLayout>
<version>0.1.0</version>
</Lorinc_HomeLayout>
</modules>
<global>
<page>
<layouts>
<Lorinc_HomeLayout translate="label">
<label>HomeLayout</label>
<template>page/HomeLayout.phtml</template>
<layout_handle>HomeLayout</layout_handle>
</Lorinc_HomeLayout>
<Lorinc_cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</Lorinc_cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And it works perfect.
这篇关于我的自定义CMS布局模板未在Magento中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!