Magento 覆盖核心块
我正在尝试覆盖Mage_Core_Block_消息 我正在创建模块 Mycompany_Core.xml并保存在路径app/etc/modules/Mycompany_Core.xml中Magento 覆盖核心块,magento,Magento,我正在尝试覆盖Mage_Core_Block_消息 我正在创建模块 Mycompany_Core.xml并保存在路径app/etc/modules/Mycompany_Core.xml中 <?xml version="1.0"?> <config> <modules> <Mycompany_Core> <active>true</active> <cod
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Core>
<active>true</active>
<codepool>local</codepool>
</Mycompany_Core>
</modules>
</config>
并在app/code/local/Mycompany/Core/etc/config.xml中添加config.xml
<config>
<modules>
<Mycompany_Core>
<version>0.0.1</version>
</Mycompany_Core>
</modules>
<global>
<blocks>
<core>
<rewrite>
<messages>Softdk_Core_Block_Messages</messages>
</rewrite>
</core>
</blocks>
</global>
</config>
0.0.1
Softdk_核心_块_消息
但我在前端没有看到任何结果,我想知道我在哪里犯了错误。
谢谢你的帮助。有两件事引起了我的注意 1.)在模块的注册文件中,它应该是
codePool
,而不是codePool
(正如David在评论中所说)
2.)什么是Softdk
?如果这是您新模块的名称,则将模块中的所有位置用Softdk
替换为Mycompany
清除缓存,瞧 请尝试使用p not pDid清除xml缓存?thx作为建议,我更改了我的错误,但仍然看不到任何结果如果你清除了缓存,那么它现在应该可以工作了。尝试在新块中回显hi或其他东西(而不是复杂的代码),以测试它是否正常工作。但我看到旧名称空间中的模块没有出现在PA->System->Configuration->Advanced中,这可能是我出现问题的原因,thx forhelp@user1958112很高兴知道它起作用了。可能是在旧名称空间中,您遇到了一些愚蠢的错误。如果答案有帮助的话,别忘了标记为已接受;)
<config>
<modules>
<Mycompany_Core>
<version>0.0.1</version>
</Mycompany_Core>
</modules>
<global>
<blocks>
<core>
<rewrite>
<messages>Softdk_Core_Block_Messages</messages>
</rewrite>
</core>
</blocks>
</global>
</config>