4

I am preparing for Magento certification exam. There's question on most of study materials that Which block type is usually used for a content block on Magento pages?

Confusion occurs when some sites say answer is Mage_Core_Block_Text_List and some say its Mage_Core_Block_Template

I think answer should be Mage_Core_Block_Template as it uses template file which outputs content from template file whereas Mage_Core_Block_Text_List just outputs childs block one by one making it structural block.

Which is the correct answer and why?

6

There is a significant difference between the two of them. While creating a custom block, it will extend Mage_Core_Block_Template almost every time. Mage_Core_Block_Text_List is a wrapper in which you can add your own blocks via your layout.xml. These core/text_list blocks don't have a template. An example of this block is the left or right column of your page (2columns-left.phtml).

So, the block that is used for a content block is Mage_Core_Block_Template, since Mage_Core_Block_Text_List doesn't have content itself.

Good luck with your exam!

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.