1

In the description of the method of getChildHtml it is said "Retrieve child block HTML" In the description of the getChildBlock method, it says "Retrieve child block by name". But what is the difference?

5
  • You can accept the answer by tick marking near to answer If it helps you :)
    – Keyur Shah
    May 7, 2018 at 10:03
  • Thanks, but for this we need to call the object of the child block? May 7, 2018 at 10:43
  • No you just need to pass block name which you can find it from layout XML file
    – Keyur Shah
    May 7, 2018 at 10:51
  • I wanted to say, for what purposes do we need to call a block object? May 7, 2018 at 11:06
  • It's up to your requirements :)
    – Keyur Shah
    May 7, 2018 at 11:17

1 Answer 1

4

As name suggest getChildHtml() render the HTML of block if it find the block and getChildBlock() will return only the Block object if it finds any block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.