2015-11-05 60 views
0

我有这个页面:我如何在页脚中添加一个新块的Magento

link

我想提出一个h1标签,如下面的图片。

enter image description here

在文件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 

CODE FOR PHTML文件

<h1>test</h1> 

我想要做的是学习使用块的网站一样简单。

你能告诉我什么是好的,什么应该纠正?

提前致谢!

回答

0

首先:创建自己的主题,而不是修改核心文件,请参阅: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> 

大功告成进行测试时,使用一些真实的名字。

相关问题