首页 文章

在Magento Admin-Panel中添加布局标识符

提问于
浏览
0

我正在尝试创建一个Magento主题 . 到目前为止,我复制了RWD并将其修改为我的愿望 . 但现在我遇到了一个问题 . 我正在尝试更改管理面板“编辑页面 - >设计”选项卡中的可用布局 . 它仅列出“空,1列,左栏2列等” . 我想在这个确切的列表中添加另一个布局,但是我无法找到要修改的相应xml文件 . page.xml允许我添加布局,但它们不会显示在下拉列表中 . 我为“1列”文本写了所有文件,但没有出现 . 我在哪里可以查找此列表的配置?

1 回答

  • 0

    你需要一个自定义模块:

    注册您的模块:

    app/etc/modules/Dropdown_Layout.xml
    

    并插入

    <?xml version="1.0"?>
    <config>
        <modules>
            <Dropdown_Layout>
                <active>true</active>
                <codePool>local</codePool>
                <depends>
                    <Mage_Page />
                </depends>
            </Dropdown_Layout>
        </modules>
    </config>
    

    您看到我们的模块依赖于Mage_page核心模块 .

    创建配置文件:

    app/code/local/Dropdown/Layout/etc/config.xml
    

    并插入

    <?xml version="1.0"?> 
    <config>
        <modules>
            <Dropdown_Layout>
                <version>1.0.0</version>
            </Dropdown_Layout>
        </modules>
        <global>
            <page>
                <layouts> 
                    <newlayout module="page" translate="label">
                        <label>newlayout</label>
                        <template>page/newlayout.phtml</template>
                        <layout_handle>newlayout</layout_handle>
                    </newlayout> 
                </layouts>
            </page>
        </global>
        <frontend>
            <layout>
                <updates>
                    <Dropdown_Layout>
                        <file>Dropdown_Layout.xml</file>
                    </Dropdown_Layout>
                </updates>
            </layout>
        </frontend>
    </config>
    

    您在配置文件中引用的布局文件

    app/design/frontend/rwd/your_theme/layout/dropdownlayout.xml
    

    并插入

    <?xml version="1.0"?> 
    <layout>
        <newlayout translate="label">
            <label>newlayout</label>
            <reference name="root">
                <action method="setTemplate"><template>page/newlayout.phtml</template></action>
                <action method="setIsHandle"><applied>1</applied></action>
            </reference>
        </newlayout> 
    </layout>
    

    和实际的html文件:

    app/design/frontend/rwd/your_theme/template/page/newlayout.phtml
    

    并插入您的HTML模板

    <!DOCTYPE html>
    <html lang="en" id="top" class="no-js">
        <head>
            ...
    

    分配模板:
    enter image description here

相关问题