简体   繁体   English

使用XML文件编辑header.phtml

[英]Editing header.phtml with an XML file

I'm working on a magento web site and I'm trying to do some changes on the header. 我正在研究一个magento网站,我正在尝试对标题进行一些更改。

I want to add 2 blocks (module) that I've made. 我想添加2块(模块),我已经做了。

Is there a way to add them without touching the header.phtml by putting : 有没有办法添加它们而不触及header.phtml放入:

  <?php echo $this->getChildHtml(' ') ?>

Is there a way using the XML files ? 有没有办法使用XML文件?

There is one placeholder in header.phtml file: header.phtml文件中有一个占位符:

<?php echo $this->getChildHtml('topContainer'); ?>

If you want to add some blocks to it just use this code: 如果你想添加一些块,只需使用这个代码:

<reference name="top.container">
   <block type="%MAGENTO_ALIAS_TO_YOUR_BLOCK%" name="block.some_name" template="path/to/your/template/file.phtml" />

   <block type="%MAGENTO_ALIAS_TO_YOUR_ANOTHER_BLOCK%" name="block.some_name2" template="path/to/your/template/file2.phtml" />
</reference>

I think it's not possible. 我认为这是不可能的。 Because when we use the code getChildHtml('abc') , we need to assign the .phtml file in the name abc. 因为当我们使用代码getChildHtml('abc') ,我们需要在名称abc中分配.phtml文件。

It's possible to add new links in Top links. 可以在Top链接中添加新链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM