【问题标题】:How can I add a new block over footer?Magento如何在页脚上添加新块? Magento
【发布时间】:2015-11-05 13:53:32
【问题描述】:

我有这个页面:

link

我想放一个h1标签,如下图。

在文件app/design/frontend/rwd/default/layout/page.xml

我添加了以下代码 XML

<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
                <block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
                    <label>Page Footer</label>
                    <action method="setElementClass"><value>bottom-container</value></action>
                </block>

                <block type="page/test2" name="test" as="test" template="page/test2/test.phtml"></block> //here is my modification

                <block type="page/switch" name="store_switcher" as="store_switcher" after="*" template="page/switch/stores.phtml"/>
                <block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml">
                    <action method="setTitle"><title>Quick Links</title></action>
                </block>
                <block type="page/template_links" name="footer_links2" as="footer_links2" template="page/template/links.phtml">
                    <action method="setTitle"><title>Account</title></action>
                </block>
                <!-- This static block can be created and populated in admin. The footer_links cms block can be used as a starting point. -->
                <!--<block type="cms/block" name="footer_social_links">
                    <action method="setBlockId"><block_id>footer_social_links</block_id></action>
                </block>-->
            </block>

然后我们创建了一个 PHTML 文件,我把它放在了位置

page/test2/test.phtml

PHTML 文件代码

<h1>test</h1>

我想做一些简单的事情,比如学习使用屏蔽网站。

你能告诉我什么是好的,什么是正确的吗?

提前致谢!

【问题讨论】:

    标签: php html xml magento


    【解决方案1】:

    首先:创建自己的主题而不是修改核心文件,参见:http://devdocs.magento.com/guides/m1x/ce19-ee114/RWD_dev-guide.html。你的代码的问题是你的块类型,试试core/template块:

    <block type="core/template" name="test" as="test" template="page/test2/test.phtml"></block>
    

    当你完成测试后,使用一些真实的名字。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-22
      • 2012-09-11
      • 1970-01-01
      • 2014-08-18
      • 2015-01-07
      相关资源
      最近更新 更多