Following are the 4 conditions.

  1. Single block and multiple templates - I think this is possible and we use it frequently while customizing Magento.
  2. Multiple blocks and single template - Never seen this one though.

Also not sure about below conditions too.

  1. Multiple block instances and single template
  2. Multiple block instances and multiple templates

Can anyone explain the above conditions and deduct whether these are true or not?

  • Single block and multiple templates: allows to implement different design / themes yet using same codebase (useful for multi stores environment)

  • multiple blocks is not something I have used. However, assuming you may enforce these blocks to implement a contract using an interface, then the template would in that case work with all these templates

  • for 3: I suggest this is same as 2 but the block instance is just the object that exists when the code is executed whereas 2 suggests we are not executing any code

  • 4: looks quite theoretical to me. But however, if 1 and 2 work for you, there is no reason you might want to implement many designs for all your blocks that fulfill the contract your template requires to work

  • This was the question in the M2 certification exam. One of 4 should be false. I don't know why they put the block and block instance conditions separately in question. – HungryDB May 31 at 10:27
  • thanks, did not know that was the case.. – Herve Tribouilloy May 31 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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