Blocks and layouts
As we learned in Chapter 2, ORM and Data Collections, Magento separates its view layer into blocks, templates, and layout files. Blocks are objects that handle part of the logic. Templates are
.phtml files that are a mix of HTML and PHP code. Layout files are XML files that control the position of the blocks.
Each module has its own layout file that is in charge of updating that specific module layout. We need to start by creating a layout file for our module:
- Navigate to
- Create a file named
- Add the following code located at
<layout version="0.1.0"> <mdg_giftregistry_index_index> </mdg_giftregistry_index_index> ...
Get Magento PHP Developer's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.