Magento 2: Why block initialized but template not rendered?Magento2: How to rename the Details tab on the...
Iron deposits mined from under the city
Computing the volume of a simplex-like object with constraints
Why doesn't "adolescent" take any articles in "listen to adolescent agonising"?
Convert an array of objects to array of the objects' values
Is there a frame of reference in which I was born before I was conceived?
Should we avoid writing fiction about historical events without extensive research?
What is a term for a function that when called repeatedly, has the same effect as calling once?
Did Amazon pay $0 in taxes last year?
Are Wave equations equivalent to Maxwell equations in free space?
Is divide-by-zero a security vulnerability?
When to use the term transposed instead of modulation?
Is this nominative case or accusative case?
Giving a talk in my old university, how prominently should I tell students my salary?
What is the meaning of option 'by' in TikZ Intersections
Gemara word for QED
Has a sovereign Communist government ever run, and conceded loss, on a fair election?
Is there such a thing in math the inverse of a sequence?
Where do you go through passport control when transiting through another Schengen airport on your way out of the Schengen area?
A bug in Excel? Conditional formatting for marking duplicates also highlights unique value
What does "rhumatis" mean?
In the world of The Matrix, what is "popping"?
Why is the electrolytic capacitor not polarity sensitive?
Does the in-code argument passing conventions used on PDP-11's have a name?
Why do we call complex numbers “numbers” but we don’t consider 2 vectors numbers?
Magento 2: Why block initialized but template not rendered?
Magento2: How to rename the Details tab on the product details page, via overwriting layout file?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Update block arguemnts in xml file (Recommended way not working)Magento 2 Custom New Block without moduleWhy Getting categories and names on product view page Magento 2 fails?Although I use the correct namespace a wrong instance is passed to the constructorI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridInvalid template file: 'Magehit_Bestsellerproducts::html/bestsellerblock.phtml'Magento 2: Add a product to the cart programmaticallyMagento 2.3 Can't view module's front end page output?
I have a page that I want to add content to it. My problem is that my block is initialized and setTemplate
is called but my template never rendered. I tried adding module name to layout (Vendor_Test::
) but it made no difference. When I edit my layout, I change the title and clean the cache, so I can see that new title is applied.
Here is my files:
Controller:
<?php
namespace VendorTestControllerExec;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
use MagentoFrameworkAppResponseInterface;
class Bank extends MagentoFrameworkAppActionAction
{
protected $resultPageFactory;
public function __construct(
Context $context,
PageFactory $resultPageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
$page = $this->resultPageFactory->create();
return $page;
}
}
My layout:
<?xml version="1.0"?>
<page layout="3column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<block class="VendorTestBlockDate" name="vendor.test.date" template="date.phtml" >
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</body>
</page>
My Block:
<?php
namespace VendorTestBlock;
class Date extends MagentoFrameworkViewElementTemplate
{
/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param array $data
*/
public function __construct(MagentoFrameworkViewElementTemplateContext $context, array $data = [])
{
parent::__construct($context, $data);
}
public function getDate()
{
return date('m/d/Y H:i:s');
}
}
My template:
<div class="Something" >
<?php echo $block->getDate();?>
</div>
Output:
magento2 layout blocks template xml
add a comment |
I have a page that I want to add content to it. My problem is that my block is initialized and setTemplate
is called but my template never rendered. I tried adding module name to layout (Vendor_Test::
) but it made no difference. When I edit my layout, I change the title and clean the cache, so I can see that new title is applied.
Here is my files:
Controller:
<?php
namespace VendorTestControllerExec;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
use MagentoFrameworkAppResponseInterface;
class Bank extends MagentoFrameworkAppActionAction
{
protected $resultPageFactory;
public function __construct(
Context $context,
PageFactory $resultPageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
$page = $this->resultPageFactory->create();
return $page;
}
}
My layout:
<?xml version="1.0"?>
<page layout="3column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<block class="VendorTestBlockDate" name="vendor.test.date" template="date.phtml" >
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</body>
</page>
My Block:
<?php
namespace VendorTestBlock;
class Date extends MagentoFrameworkViewElementTemplate
{
/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param array $data
*/
public function __construct(MagentoFrameworkViewElementTemplateContext $context, array $data = [])
{
parent::__construct($context, $data);
}
public function getDate()
{
return date('m/d/Y H:i:s');
}
}
My template:
<div class="Something" >
<?php echo $block->getDate();?>
</div>
Output:
magento2 layout blocks template xml
add a comment |
I have a page that I want to add content to it. My problem is that my block is initialized and setTemplate
is called but my template never rendered. I tried adding module name to layout (Vendor_Test::
) but it made no difference. When I edit my layout, I change the title and clean the cache, so I can see that new title is applied.
Here is my files:
Controller:
<?php
namespace VendorTestControllerExec;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
use MagentoFrameworkAppResponseInterface;
class Bank extends MagentoFrameworkAppActionAction
{
protected $resultPageFactory;
public function __construct(
Context $context,
PageFactory $resultPageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
$page = $this->resultPageFactory->create();
return $page;
}
}
My layout:
<?xml version="1.0"?>
<page layout="3column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<block class="VendorTestBlockDate" name="vendor.test.date" template="date.phtml" >
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</body>
</page>
My Block:
<?php
namespace VendorTestBlock;
class Date extends MagentoFrameworkViewElementTemplate
{
/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param array $data
*/
public function __construct(MagentoFrameworkViewElementTemplateContext $context, array $data = [])
{
parent::__construct($context, $data);
}
public function getDate()
{
return date('m/d/Y H:i:s');
}
}
My template:
<div class="Something" >
<?php echo $block->getDate();?>
</div>
Output:
magento2 layout blocks template xml
I have a page that I want to add content to it. My problem is that my block is initialized and setTemplate
is called but my template never rendered. I tried adding module name to layout (Vendor_Test::
) but it made no difference. When I edit my layout, I change the title and clean the cache, so I can see that new title is applied.
Here is my files:
Controller:
<?php
namespace VendorTestControllerExec;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
use MagentoFrameworkAppResponseInterface;
class Bank extends MagentoFrameworkAppActionAction
{
protected $resultPageFactory;
public function __construct(
Context $context,
PageFactory $resultPageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
$page = $this->resultPageFactory->create();
return $page;
}
}
My layout:
<?xml version="1.0"?>
<page layout="3column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<block class="VendorTestBlockDate" name="vendor.test.date" template="date.phtml" >
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</body>
</page>
My Block:
<?php
namespace VendorTestBlock;
class Date extends MagentoFrameworkViewElementTemplate
{
/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param array $data
*/
public function __construct(MagentoFrameworkViewElementTemplateContext $context, array $data = [])
{
parent::__construct($context, $data);
}
public function getDate()
{
return date('m/d/Y H:i:s');
}
}
My template:
<div class="Something" >
<?php echo $block->getDate();?>
</div>
Output:
magento2 layout blocks template xml
magento2 layout blocks template xml
edited May 28 '17 at 12:16
Rafael Corrêa Gomes
4,53423264
4,53423264
asked May 27 '17 at 22:30
undoneundone
2061218
2061218
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Change your layout file by following code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<referenceContainer name="content">
<block class="VendorTestBlockDate" name="vendor.test.date" template="Vendor_Test::date.phtml">
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Clear cache.
It worked! Can you point to me where was the problem? using3column
? not usingreferenceContainer
?
– undone
May 28 '17 at 12:15
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
add a comment |
In my case, I had some function calls in my template file. As one of the functions which were throwing some error. That was causing the template file from not rendering. So, anything after that function call will not display.
New contributor
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%2f176348%2fmagento-2-why-block-initialized-but-template-not-rendered%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
Change your layout file by following code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<referenceContainer name="content">
<block class="VendorTestBlockDate" name="vendor.test.date" template="Vendor_Test::date.phtml">
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Clear cache.
It worked! Can you point to me where was the problem? using3column
? not usingreferenceContainer
?
– undone
May 28 '17 at 12:15
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
add a comment |
Change your layout file by following code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<referenceContainer name="content">
<block class="VendorTestBlockDate" name="vendor.test.date" template="Vendor_Test::date.phtml">
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Clear cache.
It worked! Can you point to me where was the problem? using3column
? not usingreferenceContainer
?
– undone
May 28 '17 at 12:15
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
add a comment |
Change your layout file by following code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<referenceContainer name="content">
<block class="VendorTestBlockDate" name="vendor.test.date" template="Vendor_Test::date.phtml">
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Clear cache.
Change your layout file by following code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Bank Page Title</title>
</head>
<body>
<referenceContainer name="content">
<block class="VendorTestBlockDate" name="vendor.test.date" template="Vendor_Test::date.phtml">
<arguments>
<argument name="something" xsi:type="string">Value</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Clear cache.
answered May 28 '17 at 7:05
Sohel RanaSohel Rana
22.4k34460
22.4k34460
It worked! Can you point to me where was the problem? using3column
? not usingreferenceContainer
?
– undone
May 28 '17 at 12:15
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
add a comment |
It worked! Can you point to me where was the problem? using3column
? not usingreferenceContainer
?
– undone
May 28 '17 at 12:15
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
It worked! Can you point to me where was the problem? using
3column
? not using referenceContainer
?– undone
May 28 '17 at 12:15
It worked! Can you point to me where was the problem? using
3column
? not using referenceContainer
?– undone
May 28 '17 at 12:15
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Check <referenceContainer name="content">
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
Read more devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/…
– Sohel Rana
May 28 '17 at 13:01
add a comment |
In my case, I had some function calls in my template file. As one of the functions which were throwing some error. That was causing the template file from not rendering. So, anything after that function call will not display.
New contributor
add a comment |
In my case, I had some function calls in my template file. As one of the functions which were throwing some error. That was causing the template file from not rendering. So, anything after that function call will not display.
New contributor
add a comment |
In my case, I had some function calls in my template file. As one of the functions which were throwing some error. That was causing the template file from not rendering. So, anything after that function call will not display.
New contributor
In my case, I had some function calls in my template file. As one of the functions which were throwing some error. That was causing the template file from not rendering. So, anything after that function call will not display.
New contributor
New contributor
answered 12 mins ago
hardik thakkarhardik thakkar
1
1
New contributor
New contributor
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%2f176348%2fmagento-2-why-block-initialized-but-template-not-rendered%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