Magento Container not working in custom layout
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
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
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.
add a comment |
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
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.
add a comment |
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
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
magento2 layout blocks xml
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.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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>
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 17 '16 at 8:51
Minh DaoMinh Dao
4814
4814
add a comment |
add a comment |
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>
add a comment |
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>
add a comment |
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>
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>
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
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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