Php Magento:块覆盖将停止显示phtml
我正在处理一个Magento项目,我已经覆盖了页面Html头块,因为我需要更改Php Magento:块覆盖将停止显示phtml,php,xml,magento,overriding,Php,Xml,Magento,Overriding,我正在处理一个Magento项目,我已经覆盖了页面Html头块,因为我需要更改getLogoSrc()函数(我在app/code/core/Mage/Page/block/Html/Header.php中找到)的方式。然而,我似乎做了一些错误的事情,因为header.phtml不再被绘制 app/code/local/NameSpace/Customize/Block/Html/Header.php class NameSpace_Page_Block_Html_Header extends M
getLogoSrc()
函数(我在app/code/core/Mage/Page/block/Html/Header.php中找到)的方式。然而,我似乎做了一些错误的事情,因为header.phtml不再被绘制
app/code/local/NameSpace/Customize/Block/Html/Header.php
class NameSpace_Page_Block_Html_Header extends Mage_Page_Block_Html_Header
{
...Code...
}
app/code/local/NameSpace/Customize/etc/config.xml
<config>
<modules>
<NameSpace_Customize>
<version>0.1.0</version>
</NameSpace_Customize>
</modules>
<helpers>
<customize>
<class>NameSpace_Customize_Helper</class>
</customize>
</helpers>
<global>
<blocks>
<page>
<rewrite>
<html_header>NameSpace_Page_Block_Html_Header</html_header>
</rewrite>
</page>
</blocks>
</global>
</config>
0.1.0
命名空间\u自定义\u帮助程序
名称空间\页面\块\ Html\标题
app/etc/modules/NameSpace_Customize.xml
<config>
<modules>
<NameSpace_Customize>
<active>true</active>
<codePool>local</codePool>
</NameSpace_Customize>
</modules>
</config>
真的
地方的
当我删除config.xml中
标记内部的所有内容时,标题将正确显示
这是我的第一个Magento项目,所以我可能走错了方向。如有任何意见,将不胜感激
谢谢块类名称必须与其所在的文件夹匹配
class NameSpace_Customize_Block_Html_Header extends Mage_Page_Block_Html_Header
{
// do not write any more in here until you've tested at least once
}
在config.xml中也做同样的更改。另外,
节点必须位于
节点内
<config>
<modules>
<NameSpace_Customize>
<version>0.1.0</version>
</NameSpace_Customize>
</modules>
<global>
<helpers>
<customize>
<class>NameSpace_Customize_Helper</class>
</customize>
</helpers>
<blocks>
<page>
<rewrite>
<html_header>NameSpace_Customize_Block_Html_Header</html_header>
</rewrite>
</page>
</blocks>
</global>
</config>
0.1.0
命名空间\u自定义\u帮助程序
命名空间\自定义\块\ Html\头
块类名称必须与其所在的文件夹匹配
class NameSpace_Customize_Block_Html_Header extends Mage_Page_Block_Html_Header
{
// do not write any more in here until you've tested at least once
}
在config.xml中也做同样的更改。另外,
节点必须位于
节点内
<config>
<modules>
<NameSpace_Customize>
<version>0.1.0</version>
</NameSpace_Customize>
</modules>
<global>
<helpers>
<customize>
<class>NameSpace_Customize_Helper</class>
</customize>
</helpers>
<blocks>
<page>
<rewrite>
<html_header>NameSpace_Customize_Block_Html_Header</html_header>
</rewrite>
</page>
</blocks>
</global>
</config>
0.1.0
命名空间\u自定义\u帮助程序
命名空间\自定义\块\ Html\头
块类名称必须与其所在的文件夹匹配
class NameSpace_Customize_Block_Html_Header extends Mage_Page_Block_Html_Header
{
// do not write any more in here until you've tested at least once
}
在config.xml中也做同样的更改。另外,
节点必须位于
节点内
<config>
<modules>
<NameSpace_Customize>
<version>0.1.0</version>
</NameSpace_Customize>
</modules>
<global>
<helpers>
<customize>
<class>NameSpace_Customize_Helper</class>
</customize>
</helpers>
<blocks>
<page>
<rewrite>
<html_header>NameSpace_Customize_Block_Html_Header</html_header>
</rewrite>
</page>
</blocks>
</global>
</config>
0.1.0
命名空间\u自定义\u帮助程序
命名空间\自定义\块\ Html\头
块类名称必须与其所在的文件夹匹配
class NameSpace_Customize_Block_Html_Header extends Mage_Page_Block_Html_Header
{
// do not write any more in here until you've tested at least once
}
在config.xml中也做同样的更改。另外,
节点必须位于
节点内
<config>
<modules>
<NameSpace_Customize>
<version>0.1.0</version>
</NameSpace_Customize>
</modules>
<global>
<helpers>
<customize>
<class>NameSpace_Customize_Helper</class>
</customize>
</helpers>
<blocks>
<page>
<rewrite>
<html_header>NameSpace_Customize_Block_Html_Header</html_header>
</rewrite>
</page>
</blocks>
</global>
</config>
0.1.0
命名空间\u自定义\u帮助程序
命名空间\自定义\块\ Html\头
只是一个意见,但我会将所有内容规范化为名称空间(包括文件夹),而不是名称空间。很难为单词的属性插入制定一套可靠的规则,而且肯定会犯错误。这只是一个观点,但我会将所有内容规范化为名称空间(包括文件夹),而不是名称空间。很难为单词的属性插入制定一套可靠的规则,而且肯定会犯错误。这只是一个观点,但我会将所有内容规范化为名称空间(包括文件夹),而不是名称空间。很难为单词的属性插入制定一套可靠的规则,而且肯定会犯错误。这只是一个观点,但我会将所有内容规范化为名称空间(包括文件夹),而不是名称空间。很难想出一套可靠的词语属性互换规则,而且肯定会犯错误。