/   /   /  Magento 2 Snippet: Add block to start or end of page

Note:

For more extensions and themes visit our store

Magento 2 Snippet: Add block to start or end of page


Inside Vendor/Module/view/frontend/layout/default.xml

  1.  
  2. <?xml version="1.0"?>
  3. <page  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  4.     <body>
  5.         <referenceContainer name="after.body.start">
  6.             <block class="Vendor\Module\Block\NotificationBar" name="notificationbar" as="notificationbar" template="Vendor_Module::notificationbar.phtml"/>
  7.         </referenceContainer>
  8.         <referenceContainer name="before.body.end">
  9.             <block class="Vendor\Module\Block\NotificationBarBottom" name="notificationbarbottom" as="notificationbarbottom" template="Vendor_Module::notificationbarbottom.phtml"/>
  10.         </referenceContainer>
  11.     </body>
  12. </page>

Done

Comments

IBNAB is a company made of a group of professionals whose work is providing secure open source solutions. Our company strives for reaching magnificent results with each experience and provides professional open source solutions that cover every part of the business process.