分享

如何在相同的布局中使用不同的页头(header)

 顾于思文摘馆 2014-11-20
第一步:
找到
/app/design/frontend/default/default/template/page/html
复制header.phtml为另外一个文件,例如header2.html

第二步:
/app/design/frontend/default/default/layout
修改page.xml
你可以直接复制与header有关的Block并且把命题替换成上一步中你设定的
<block type="page/html_header2" name="header2" as="header2">
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>
</block>

第三步:
/app/code/core/Mage/Page/Block/Html
复制Header.php为Header2.php(同第一步)

第四步:
找到Header2.php中的部分代码(在头部),
class Mage_Page_Block_Html_Header extends Mage_Core_Block_Template
{
public function _construct()
{
$this->setTemplate(’page/html/header.phtml’);
}

修改成:
class Mage_Page_Block_Html_Header2 extends Mage_Core_Block_Template
{
public function _construct()
{
$this->setTemplate(’page/html/header2.phtml’);
}

成功了。。。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多