Magento. Insert block into another without change template code

前端 未结 7 1902
耶瑟儿~
耶瑟儿~ 2021-02-06 01:36

I\'ve tried to find solution but with no results. My task is to write module. It should insert some html into existing block.

I noticed that when I used layout .xml file

7条回答
  •  礼貌的吻别
    2021-02-06 01:57

    No, there is not a generic way to add your block to any other block. The reason it works occasionally for you is that there are some block types that just enumerate their children (core/text_list being one of those) and some templates manually do the same (using $this->getChild()).

    If you want to add your block underneath a block that fits neither of these criteria, you will need to modify the template to echo that block.

提交回复
热议问题