magento - 为什么我的区 block 没有显示?

标签 magento

我不知道为什么我的区 block 没有显示。它没有显示在任何页面上,我清除了缓存。有人可以帮我弄清楚我错过了什么吗?但是,var_dump('test') 出现了!

app/design/frontend/default/default/template/justin/head.phtml

testing this block

贾斯汀/比伯/Block/Sings.php

class Justin_Bieber_Block_Sings extends Mage_Core_Block_Template
{
    protected function _construct()
    {
        parent::_construct();
        var_dump("test");
    }
}   

配置.xml

<frontend>
       ...
    <layout>
        <updates>
            <bieber>
                <file>justin.xml</file>
            </bieber>
        </updates>
    </layout>
</frontend>
<global>
    <blocks>
        <bieber>
            <class>Justin_Bieber_Block</class>
        </bieber>
    </blocks>
    ...
</global>

app/design/frontend/default/default/layout/justin.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <block type="bieber/bieber" name="justin_bieber">
                 <action method="setTemplate">
                    <template>justin/head.phtml</template>
                </action>
            </block>
        </reference>
    </default>
</layout>

最佳答案

在你的 justin.xml block 类型中应该是

 <block type="bieber/sings" name="justin_bieber">

在本例中,“bieber”是您的模块别名,“sings”是类名。

关于magento - 为什么我的区 block 没有显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11705812/

相关文章:

php - 从缓存中获取图像 MAGENTO

javascript - 从内部页面隐藏横幅 - magento

玛根托 : show new products on home page

php - 是否可以跟踪 magentos admin 中的所有/大部分更改?

magento - 如何捕获部分金额

magento - 将 magento apis 用于电子商务网站

php - 来自模型的 Magento SQL 查询

database - magento:生产、登台和开发之间的数据库同步

Magento CSS 和 JS 路径不正确

apache - 网站结帐在最新版本的 Chrome/Firefox 中不起作用; Apache SSL 密码问题