Skip to content

Instantly share code, notes, and snippets.

@wpoortman
Last active August 12, 2020 13:47
Show Gist options
  • Save wpoortman/e5869b169740c90de32687fe0b007fff to your computer and use it in GitHub Desktop.
Save wpoortman/e5869b169740c90de32687fe0b007fff to your computer and use it in GitHub Desktop.
Magento 2 - Template
<?xml version="1.0"?>
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<body>
<referenceBlock name="content">
<block
name="path.to.your.awesome.template-file"
template="Vendor_Namespace::path/to/your/awesome/template-file.phtml"
/>
</referenceBlock>
</body>
</page>
<!-- Block name always corresponds with your template file patch and visa versa -->
<!-- This way your block name is always unique and you dont have to come up with some vague name no one understands -->
<!-- Use the same path within your ViewModel folder when a View Model is required -->
<!-- Combine the last folder name and template file name when your file is named list, new or some other php reserved namespace -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment