在Magento一个新的主题,新的页面布局,页眉和页脚的工作,但不是背景.为什么?


In Magento a new theme, new page layout, the header and footer work, but not the background. Why?

我对此完全陌生,只是想不通。这是代码:

page.xml

<layout version="0.1.0">
    <default translate="label" module="page">
        <label>All Pages</label>
        <block type="page/html" name="root" output="toHtml" template="page/pd-1column.phtml">
            <!-- Add Styles to Head -->
            <block type="page/html_head" name="head" as="head">
                <action method="addCss"><stylesheet>css/style.css</stylesheet></action>
            </block>
            <!-- Our Header -->
            <block type="page/html_header" name="header" as="header" translate="label">
                <label>Header</label>
            </block>

            <!-- Background -->
            <block type="page/html_background" name="background" as="background" translate="label">
                <label>Background</label>
            </block>
            <!-- The Footer -->
            <block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
                <label>Footer</label>
            </block>
        </block>
    </default>
</layout>

pd-1column.html

<!DOCTYPE html>
<head>
    <?php echo $this->getChildHtml('head'); ?>
</head>
<body>
    <div id="wrapper">
            <?php echo $this->getChildHtml('header'); ?>      
            <?php echo $this->getChildHtml('background'); ?>      
            <?php echo $this->getChildHtml('footer'); ?>
    </div>
</body>
</html>

文件名:header.phtml、background.phtml、footer.phtml

我做错了什么?

编辑:解决方案是将page.xml文件修改为

<block type="page/html_header" name="background" as="background" template="page/html/background.phtml">
            <label>Background</label>
 </block>
 <block type="page/html_header" name="header" as="header" translate="label">

在此page/html_header中,类型对应于中存在的块类文件

app/code/core/Mage/Page/Block/Html/Header.php

这是核心Magento块类。每个块类型都指向一个特定的类文件。因此,您的头模板可以访问Header.php 中的所有这些方法

类似地,Background.php块不存在于路径app/code/core/Mage/Page/Block/Html/

块在这里有更好的解释