0

I am creating page layout using xml

<referenceContainer name="content">
    <container name="page.container.main" htmlTag="div" htmlClass="page-container-main" before="-">
        <block name="page.container.h2" class="Magento\Framework\View\Element\Text" before="-">
            <arguments>
                <argument translate="true" name="text" xsi:type="string"><![CDATA[<h2>Page List</div>]]></argument>
            </arguments>
        </block>
    </container>
</referenceContainer>

<referenceContainer name="page.container.main">
    <container name="page.container.info" htmlTag="section" htmlClass="page-lists" after="page.container.h2">
        <block name="page.container.text" class="Magento\Framework\View\Element\Text" before="-">
            <arguments>
                <argument translate="true" name="text" xsi:type="string">Simple Text</argument>
            </arguments>
        </block>
    </container>
</referenceContainer>

I want to display page output in div page-container-main show h2 tag and after show text in but current output is

<div class="page-container-main">
    <h2>Page List</h2>
</div>
<section class="page-lists">Simple Text</section>

As shown 'Simple Text' section is rendering out of page-container-main div but what i am actually expecting is below

<div class="page-container-main">
    <h2>Page List</h2>
    <section class="page-lists">Simple Text</section>
</div>
2
  • add this <?xml version="1.0"?> starting of your xml – Dharmendra Jadav Sep 27 '18 at 7:16
  • @DharmendraJadav it is just a reference code, i have did in my system code – Himanshu Sep 27 '18 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.