Как получить окно подписчика на рассылку новостей и показать пользовательский модуль в Magento 2


Я создал пользовательскую страницу нижнего колонтитула, и она отлично отображается с 5 столбцами. Здесь я хочу показать Окно подписчика на рассылку в моем пользовательском файле .phtml для этого я пытался получить <?php echo $block->getChildHtml('newsletter'); ?> и <?php echo $block->getChildHtml('form.subscriber'); ?>, Но здесь нечего отображать. Для этого я написал ниже код.

Layout/default.xml

<?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>
        <referenceContainer name="footer-container">
            <referenceBlock name="footer_links" remove="true"/>
            <referenceBlock name="report.bugs" remove="true"/>
            <referenceBlock name="form.subscribe" remove="true"/>
            <!--<referenceBlock name="footer.newsletter" remove="true"/>-->
            <block class="Magento\Theme\Block\Html\Footer" name="custom_block" as="custom_block" template="Test_CustomFooter::custom.phtml"/>
        </referenceContainer>
    </body>
</page>

Шаблоны/пользовательский.phtml

<?php /** @var  \Magento\Theme\Block\Html\Footer $block */ ?>
......code.....
<div class="col">
                <h3 class="title">EMail</h3>
                <div class="widget-content">
                    <?php echo $block->getChildHtml('newsletter'); ?>
                </div>
            </div>
.......code......

Так что не могли бы вы, пожалуйста, подсказать мне, как отобразить здесь..

enter image description here

Author: Bojjaiah, 2016-11-30

1 answers

Измените свой XML-код макета:

<?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>
        <referenceContainer name="footer-container">
            <referenceBlock name="footer_links" remove="true"/>
            <referenceBlock name="report.bugs" remove="true"/>
            <referenceBlock name="form.subscribe" remove="true"/>
            <!--<referenceBlock name="footer.newsletter" remove="true"/>-->
            <block class="Magento\Theme\Block\Html\Footer" name="custom_block" as="custom_block" template="Test_CustomFooter::custom.phtml"/>
        </referenceContainer>
    </body>
</page>

Кому:

<?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>
        <referenceContainer name="footer-container">
            <referenceBlock name="footer_links" remove="true"/>
            <referenceBlock name="report.bugs" remove="true"/>            
            <block class="Magento\Theme\Block\Html\Footer" name="custom_block" as="custom_block" template="Test_CustomFooter::custom.phtml"/>
        </referenceContainer>
    </body>
</page>

Добавьте приведенный ниже код в файл phtml:

<?php echo $block->getChildHtml('form.subscribe'); ?>
 1
Author: Prashant Valanda, 2016-11-30 12:56:05