Magento Container not working in custom layout





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I have created a custom XML layout page that I will be using for my home page. Right now it is a clone of the normal 1column.xml layout, and I'm trying to add a container for an image slider.



Here is the code I have added to my layout file (home_page.xml):



<container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top"/>


This should in theory produce the following HTML code on the home page:



<div class="slider-container" id="slider.container"> </div>


However, absolutely nothing is happening. I cannot find the container when inspecting all of the elements on the page with the F12 console. I have also added some test CCS to "slider-container" just to be sure, and absolutely nothing is showing.



My custom XML layout page should be working fine. If I remove the footer or header container from the layout file, and flush the cache, they disappear from the page as they should. This tells me that everything is set up and working correctly, but something isn't working correctly within the file.










share|improve this question














bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    3















    I have created a custom XML layout page that I will be using for my home page. Right now it is a clone of the normal 1column.xml layout, and I'm trying to add a container for an image slider.



    Here is the code I have added to my layout file (home_page.xml):



    <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top"/>


    This should in theory produce the following HTML code on the home page:



    <div class="slider-container" id="slider.container"> </div>


    However, absolutely nothing is happening. I cannot find the container when inspecting all of the elements on the page with the F12 console. I have also added some test CCS to "slider-container" just to be sure, and absolutely nothing is showing.



    My custom XML layout page should be working fine. If I remove the footer or header container from the layout file, and flush the cache, they disappear from the page as they should. This tells me that everything is set up and working correctly, but something isn't working correctly within the file.










    share|improve this question














    bumped to the homepage by Community 2 days ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      3












      3








      3








      I have created a custom XML layout page that I will be using for my home page. Right now it is a clone of the normal 1column.xml layout, and I'm trying to add a container for an image slider.



      Here is the code I have added to my layout file (home_page.xml):



      <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top"/>


      This should in theory produce the following HTML code on the home page:



      <div class="slider-container" id="slider.container"> </div>


      However, absolutely nothing is happening. I cannot find the container when inspecting all of the elements on the page with the F12 console. I have also added some test CCS to "slider-container" just to be sure, and absolutely nothing is showing.



      My custom XML layout page should be working fine. If I remove the footer or header container from the layout file, and flush the cache, they disappear from the page as they should. This tells me that everything is set up and working correctly, but something isn't working correctly within the file.










      share|improve this question














      I have created a custom XML layout page that I will be using for my home page. Right now it is a clone of the normal 1column.xml layout, and I'm trying to add a container for an image slider.



      Here is the code I have added to my layout file (home_page.xml):



      <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top"/>


      This should in theory produce the following HTML code on the home page:



      <div class="slider-container" id="slider.container"> </div>


      However, absolutely nothing is happening. I cannot find the container when inspecting all of the elements on the page with the F12 console. I have also added some test CCS to "slider-container" just to be sure, and absolutely nothing is showing.



      My custom XML layout page should be working fine. If I remove the footer or header container from the layout file, and flush the cache, they disappear from the page as they should. This tells me that everything is set up and working correctly, but something isn't working correctly within the file.







      magento2 layout blocks xml






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 15 '16 at 13:49









      DaveDave

      162




      162





      bumped to the homepage by Community 2 days ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 2 days ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          The main problem is: <div class="slider-container" id="slider.container"></div>
          did not rendered when it have not any child element in it.
          You must set block in this container. Ex:



          <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top">
          <block class="MagentoFrameworkViewElementTemplate" after="-" name="abc" template="PATH_YOUR_TEMPLATE" />
          </container>


          Or you can use <move> element with destination is 'slider.container' (name of container) to have child element in it.






          share|improve this answer































            0














            Clear cache and page_cache may help you fix this problem



            <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
            <head>
            </head>
            <body>
            <referenceContainer name="content">
            <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="">
            <block class="VendorModuleBlockExampleBlock" name="block.slider" as="slider.cms" template="Vendor_MOdule::yourblocktemplate.phtml" after="-" />
            </container>
            </referenceContainer>
            </body>







            share|improve this answer


























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "479"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f106367%2fmagento-container-not-working-in-custom-layout%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              The main problem is: <div class="slider-container" id="slider.container"></div>
              did not rendered when it have not any child element in it.
              You must set block in this container. Ex:



              <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top">
              <block class="MagentoFrameworkViewElementTemplate" after="-" name="abc" template="PATH_YOUR_TEMPLATE" />
              </container>


              Or you can use <move> element with destination is 'slider.container' (name of container) to have child element in it.






              share|improve this answer




























                0














                The main problem is: <div class="slider-container" id="slider.container"></div>
                did not rendered when it have not any child element in it.
                You must set block in this container. Ex:



                <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top">
                <block class="MagentoFrameworkViewElementTemplate" after="-" name="abc" template="PATH_YOUR_TEMPLATE" />
                </container>


                Or you can use <move> element with destination is 'slider.container' (name of container) to have child element in it.






                share|improve this answer


























                  0












                  0








                  0







                  The main problem is: <div class="slider-container" id="slider.container"></div>
                  did not rendered when it have not any child element in it.
                  You must set block in this container. Ex:



                  <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top">
                  <block class="MagentoFrameworkViewElementTemplate" after="-" name="abc" template="PATH_YOUR_TEMPLATE" />
                  </container>


                  Or you can use <move> element with destination is 'slider.container' (name of container) to have child element in it.






                  share|improve this answer













                  The main problem is: <div class="slider-container" id="slider.container"></div>
                  did not rendered when it have not any child element in it.
                  You must set block in this container. Ex:



                  <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="page.top">
                  <block class="MagentoFrameworkViewElementTemplate" after="-" name="abc" template="PATH_YOUR_TEMPLATE" />
                  </container>


                  Or you can use <move> element with destination is 'slider.container' (name of container) to have child element in it.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 17 '16 at 8:51









                  Minh DaoMinh Dao

                  4814




                  4814

























                      0














                      Clear cache and page_cache may help you fix this problem



                      <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                      <head>
                      </head>
                      <body>
                      <referenceContainer name="content">
                      <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="">
                      <block class="VendorModuleBlockExampleBlock" name="block.slider" as="slider.cms" template="Vendor_MOdule::yourblocktemplate.phtml" after="-" />
                      </container>
                      </referenceContainer>
                      </body>







                      share|improve this answer






























                        0














                        Clear cache and page_cache may help you fix this problem



                        <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                        <head>
                        </head>
                        <body>
                        <referenceContainer name="content">
                        <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="">
                        <block class="VendorModuleBlockExampleBlock" name="block.slider" as="slider.cms" template="Vendor_MOdule::yourblocktemplate.phtml" after="-" />
                        </container>
                        </referenceContainer>
                        </body>







                        share|improve this answer




























                          0












                          0








                          0







                          Clear cache and page_cache may help you fix this problem



                          <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                          <head>
                          </head>
                          <body>
                          <referenceContainer name="content">
                          <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="">
                          <block class="VendorModuleBlockExampleBlock" name="block.slider" as="slider.cms" template="Vendor_MOdule::yourblocktemplate.phtml" after="-" />
                          </container>
                          </referenceContainer>
                          </body>







                          share|improve this answer















                          Clear cache and page_cache may help you fix this problem



                          <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                          <head>
                          </head>
                          <body>
                          <referenceContainer name="content">
                          <container name="slider.container" htmlTag="div" htmlId="slider.container" htmlClass="slider-container" before="">
                          <block class="VendorModuleBlockExampleBlock" name="block.slider" as="slider.cms" template="Vendor_MOdule::yourblocktemplate.phtml" after="-" />
                          </container>
                          </referenceContainer>
                          </body>








                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jun 7 '18 at 18:58









                          Rohan Hapani

                          6,87931865




                          6,87931865










                          answered Mar 15 '16 at 14:34









                          mrtuvnmrtuvn

                          1,88411829




                          1,88411829






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f106367%2fmagento-container-not-working-in-custom-layout%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              What other Star Trek series did the main TNG cast show up in?

                              Berlina muro

                              Berlina aerponto