Magento 2 add block phtml to every page
-
11-12-2020 - |
문제
I have a modal to show in every page, my modal was created in phtml file which using custom block file. i want to show this modal in every page of magento, is there a way to do this?
해결책
you can do this by following layout xml file.
app/code/Company/Module/view/frontend/layout/default.xml
the content would be like this:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
// reference a container to show your model
</body>
</page>
NOTE: you can refer any core module's layout file for above content.
제휴하지 않습니다 magento.stackexchange