how do you call Blocks in Controller Magento2?
I want getBlock Adb/Block/Index in controller Adb/Controller/Category/View
. So How do it?
Edit
in controller.
namespace AddonFaqControllerCategory;
class View extends AddonFaqControllerCategory
{
/**
* @var MagentoFrameworkControllerResultForwardFactory
*/
protected $_coreRegistry = null;
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory ;
/**
* @param MagentoBackendAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkRegistry $registry
) {
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}
/**
* Product list page
*
* @return MagentoBackendModelViewResultPage
*/
public function execute()
{
$resultPage = $this->resultPageFactory ->create();
$blockInstance = $resultPage->getLayout()->getBlock('category.index');
}
}
layout in frontend
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="AddonFaqBlockFaq" name="category.index" template="Addon_Faq::view.phtml"/>
</referenceContainer>
</body>
</page>
It not call block Faq
magento2 magento2-dev-beta
add a comment |
I want getBlock Adb/Block/Index in controller Adb/Controller/Category/View
. So How do it?
Edit
in controller.
namespace AddonFaqControllerCategory;
class View extends AddonFaqControllerCategory
{
/**
* @var MagentoFrameworkControllerResultForwardFactory
*/
protected $_coreRegistry = null;
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory ;
/**
* @param MagentoBackendAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkRegistry $registry
) {
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}
/**
* Product list page
*
* @return MagentoBackendModelViewResultPage
*/
public function execute()
{
$resultPage = $this->resultPageFactory ->create();
$blockInstance = $resultPage->getLayout()->getBlock('category.index');
}
}
layout in frontend
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="AddonFaqBlockFaq" name="category.index" template="Addon_Faq::view.phtml"/>
</referenceContainer>
</body>
</page>
It not call block Faq
magento2 magento2-dev-beta
1
You should not call blocks in controller. Why do you need it?
– KAndy
Oct 26 '15 at 16:36
add a comment |
I want getBlock Adb/Block/Index in controller Adb/Controller/Category/View
. So How do it?
Edit
in controller.
namespace AddonFaqControllerCategory;
class View extends AddonFaqControllerCategory
{
/**
* @var MagentoFrameworkControllerResultForwardFactory
*/
protected $_coreRegistry = null;
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory ;
/**
* @param MagentoBackendAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkRegistry $registry
) {
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}
/**
* Product list page
*
* @return MagentoBackendModelViewResultPage
*/
public function execute()
{
$resultPage = $this->resultPageFactory ->create();
$blockInstance = $resultPage->getLayout()->getBlock('category.index');
}
}
layout in frontend
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="AddonFaqBlockFaq" name="category.index" template="Addon_Faq::view.phtml"/>
</referenceContainer>
</body>
</page>
It not call block Faq
magento2 magento2-dev-beta
I want getBlock Adb/Block/Index in controller Adb/Controller/Category/View
. So How do it?
Edit
in controller.
namespace AddonFaqControllerCategory;
class View extends AddonFaqControllerCategory
{
/**
* @var MagentoFrameworkControllerResultForwardFactory
*/
protected $_coreRegistry = null;
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory ;
/**
* @param MagentoBackendAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkRegistry $registry
) {
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}
/**
* Product list page
*
* @return MagentoBackendModelViewResultPage
*/
public function execute()
{
$resultPage = $this->resultPageFactory ->create();
$blockInstance = $resultPage->getLayout()->getBlock('category.index');
}
}
layout in frontend
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="AddonFaqBlockFaq" name="category.index" template="Addon_Faq::view.phtml"/>
</referenceContainer>
</body>
</page>
It not call block Faq
magento2 magento2-dev-beta
magento2 magento2-dev-beta
edited yesterday
treyBake
280115
280115
asked Oct 26 '15 at 9:00
xankaxanka
98331849
98331849
1
You should not call blocks in controller. Why do you need it?
– KAndy
Oct 26 '15 at 16:36
add a comment |
1
You should not call blocks in controller. Why do you need it?
– KAndy
Oct 26 '15 at 16:36
1
1
You should not call blocks in controller. Why do you need it?
– KAndy
Oct 26 '15 at 16:36
You should not call blocks in controller. Why do you need it?
– KAndy
Oct 26 '15 at 16:36
add a comment |
4 Answers
4
active
oldest
votes
Your return nothing in your execute command. Return resultpage in your controller
$resultPage = $this->resultPageFactory->create();
return $resultPage;
your xml name should be faq_category_view.xml.
add a comment |
If you want to instantiate a block you need to add to inject in the constructor an instance of MagentoFrameworkViewLayoutFactory
...
protected $layoutFactory;
...
public function __construct(
...
MagentoFrameworkViewLayoutFactory $layoutFactory,
...
) {
...
$this->layoutFactory = $layoutFactory;
...
}
Then you can instantiate a block like this:
$this->layoutFactory->create()->createBlock('BlockClassHere');
if you want to access a block defined in the layout you need to inject in the constructor and instance of MagentoFrameworkViewResultPageFactory
...
protected $resultPageFactory;
...
public function __construct(
...
MagentoFrameworkViewResultPageFactory $resultPageFactory,
...
) {
...
$this->resultPageFactory = $resultPageFactory;
...
}
Then you will be able to access the block like this:
$resultPage = $resultPageFactory->create();
$blockInstance = $resultPage->getLayout()->getBlock('block.name.here');
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
add a comment |
Create the block:
<?php
namespace TrainingTestBlock;
class Test extends MagentoFrameworkViewElementAbstractBlock
{
protected function _toHtml() {
return "<b>Hello world from block!</b>";
}
}
Create an action class:
<?php
namespace TrainingTestControllerBlock;
class Index extends MagentoFrameworkAppActionAction
{
public function execute() {
$layout = $this->_view->getLayout();
$block = $layout->createBlock('TrainingTestBlockTest');
$this->getResponse()->appendBody($block->toHtml());
}
}
Do not use$this->_view
in controllers. I read it is@deprecated
. UseresultPage->getLayout()
instead like the other answer suggests.
– 7ochem
Nov 21 '16 at 10:57
add a comment |
See the core code:
Step 1
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L26-L34
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
Step 2
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L69-L70
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
Step 3
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L119
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
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%2f87629%2fhow-do-you-call-blocks-in-controller-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your return nothing in your execute command. Return resultpage in your controller
$resultPage = $this->resultPageFactory->create();
return $resultPage;
your xml name should be faq_category_view.xml.
add a comment |
Your return nothing in your execute command. Return resultpage in your controller
$resultPage = $this->resultPageFactory->create();
return $resultPage;
your xml name should be faq_category_view.xml.
add a comment |
Your return nothing in your execute command. Return resultpage in your controller
$resultPage = $this->resultPageFactory->create();
return $resultPage;
your xml name should be faq_category_view.xml.
Your return nothing in your execute command. Return resultpage in your controller
$resultPage = $this->resultPageFactory->create();
return $resultPage;
your xml name should be faq_category_view.xml.
answered Oct 26 '15 at 10:29
Shaheer AliShaheer Ali
1,35831125
1,35831125
add a comment |
add a comment |
If you want to instantiate a block you need to add to inject in the constructor an instance of MagentoFrameworkViewLayoutFactory
...
protected $layoutFactory;
...
public function __construct(
...
MagentoFrameworkViewLayoutFactory $layoutFactory,
...
) {
...
$this->layoutFactory = $layoutFactory;
...
}
Then you can instantiate a block like this:
$this->layoutFactory->create()->createBlock('BlockClassHere');
if you want to access a block defined in the layout you need to inject in the constructor and instance of MagentoFrameworkViewResultPageFactory
...
protected $resultPageFactory;
...
public function __construct(
...
MagentoFrameworkViewResultPageFactory $resultPageFactory,
...
) {
...
$this->resultPageFactory = $resultPageFactory;
...
}
Then you will be able to access the block like this:
$resultPage = $resultPageFactory->create();
$blockInstance = $resultPage->getLayout()->getBlock('block.name.here');
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
add a comment |
If you want to instantiate a block you need to add to inject in the constructor an instance of MagentoFrameworkViewLayoutFactory
...
protected $layoutFactory;
...
public function __construct(
...
MagentoFrameworkViewLayoutFactory $layoutFactory,
...
) {
...
$this->layoutFactory = $layoutFactory;
...
}
Then you can instantiate a block like this:
$this->layoutFactory->create()->createBlock('BlockClassHere');
if you want to access a block defined in the layout you need to inject in the constructor and instance of MagentoFrameworkViewResultPageFactory
...
protected $resultPageFactory;
...
public function __construct(
...
MagentoFrameworkViewResultPageFactory $resultPageFactory,
...
) {
...
$this->resultPageFactory = $resultPageFactory;
...
}
Then you will be able to access the block like this:
$resultPage = $resultPageFactory->create();
$blockInstance = $resultPage->getLayout()->getBlock('block.name.here');
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
add a comment |
If you want to instantiate a block you need to add to inject in the constructor an instance of MagentoFrameworkViewLayoutFactory
...
protected $layoutFactory;
...
public function __construct(
...
MagentoFrameworkViewLayoutFactory $layoutFactory,
...
) {
...
$this->layoutFactory = $layoutFactory;
...
}
Then you can instantiate a block like this:
$this->layoutFactory->create()->createBlock('BlockClassHere');
if you want to access a block defined in the layout you need to inject in the constructor and instance of MagentoFrameworkViewResultPageFactory
...
protected $resultPageFactory;
...
public function __construct(
...
MagentoFrameworkViewResultPageFactory $resultPageFactory,
...
) {
...
$this->resultPageFactory = $resultPageFactory;
...
}
Then you will be able to access the block like this:
$resultPage = $resultPageFactory->create();
$blockInstance = $resultPage->getLayout()->getBlock('block.name.here');
If you want to instantiate a block you need to add to inject in the constructor an instance of MagentoFrameworkViewLayoutFactory
...
protected $layoutFactory;
...
public function __construct(
...
MagentoFrameworkViewLayoutFactory $layoutFactory,
...
) {
...
$this->layoutFactory = $layoutFactory;
...
}
Then you can instantiate a block like this:
$this->layoutFactory->create()->createBlock('BlockClassHere');
if you want to access a block defined in the layout you need to inject in the constructor and instance of MagentoFrameworkViewResultPageFactory
...
protected $resultPageFactory;
...
public function __construct(
...
MagentoFrameworkViewResultPageFactory $resultPageFactory,
...
) {
...
$this->resultPageFactory = $resultPageFactory;
...
}
Then you will be able to access the block like this:
$resultPage = $resultPageFactory->create();
$blockInstance = $resultPage->getLayout()->getBlock('block.name.here');
edited Apr 8 '16 at 13:43
Amit Bera♦
57.3k1474170
57.3k1474170
answered Oct 26 '15 at 9:09
Marius♦Marius
163k28311660
163k28311660
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
add a comment |
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
is this still the recommended way of calling the block? Can I not inject? :)
– treyBake
Dec 18 '18 at 16:43
add a comment |
Create the block:
<?php
namespace TrainingTestBlock;
class Test extends MagentoFrameworkViewElementAbstractBlock
{
protected function _toHtml() {
return "<b>Hello world from block!</b>";
}
}
Create an action class:
<?php
namespace TrainingTestControllerBlock;
class Index extends MagentoFrameworkAppActionAction
{
public function execute() {
$layout = $this->_view->getLayout();
$block = $layout->createBlock('TrainingTestBlockTest');
$this->getResponse()->appendBody($block->toHtml());
}
}
Do not use$this->_view
in controllers. I read it is@deprecated
. UseresultPage->getLayout()
instead like the other answer suggests.
– 7ochem
Nov 21 '16 at 10:57
add a comment |
Create the block:
<?php
namespace TrainingTestBlock;
class Test extends MagentoFrameworkViewElementAbstractBlock
{
protected function _toHtml() {
return "<b>Hello world from block!</b>";
}
}
Create an action class:
<?php
namespace TrainingTestControllerBlock;
class Index extends MagentoFrameworkAppActionAction
{
public function execute() {
$layout = $this->_view->getLayout();
$block = $layout->createBlock('TrainingTestBlockTest');
$this->getResponse()->appendBody($block->toHtml());
}
}
Do not use$this->_view
in controllers. I read it is@deprecated
. UseresultPage->getLayout()
instead like the other answer suggests.
– 7ochem
Nov 21 '16 at 10:57
add a comment |
Create the block:
<?php
namespace TrainingTestBlock;
class Test extends MagentoFrameworkViewElementAbstractBlock
{
protected function _toHtml() {
return "<b>Hello world from block!</b>";
}
}
Create an action class:
<?php
namespace TrainingTestControllerBlock;
class Index extends MagentoFrameworkAppActionAction
{
public function execute() {
$layout = $this->_view->getLayout();
$block = $layout->createBlock('TrainingTestBlockTest');
$this->getResponse()->appendBody($block->toHtml());
}
}
Create the block:
<?php
namespace TrainingTestBlock;
class Test extends MagentoFrameworkViewElementAbstractBlock
{
protected function _toHtml() {
return "<b>Hello world from block!</b>";
}
}
Create an action class:
<?php
namespace TrainingTestControllerBlock;
class Index extends MagentoFrameworkAppActionAction
{
public function execute() {
$layout = $this->_view->getLayout();
$block = $layout->createBlock('TrainingTestBlockTest');
$this->getResponse()->appendBody($block->toHtml());
}
}
edited Nov 4 '15 at 12:14
answered Nov 4 '15 at 11:58
Rakesh JesadiyaRakesh Jesadiya
28.6k1571119
28.6k1571119
Do not use$this->_view
in controllers. I read it is@deprecated
. UseresultPage->getLayout()
instead like the other answer suggests.
– 7ochem
Nov 21 '16 at 10:57
add a comment |
Do not use$this->_view
in controllers. I read it is@deprecated
. UseresultPage->getLayout()
instead like the other answer suggests.
– 7ochem
Nov 21 '16 at 10:57
Do not use
$this->_view
in controllers. I read it is @deprecated
. Use resultPage->getLayout()
instead like the other answer suggests.– 7ochem
Nov 21 '16 at 10:57
Do not use
$this->_view
in controllers. I read it is @deprecated
. Use resultPage->getLayout()
instead like the other answer suggests.– 7ochem
Nov 21 '16 at 10:57
add a comment |
See the core code:
Step 1
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L26-L34
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
Step 2
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L69-L70
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
Step 3
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L119
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
add a comment |
See the core code:
Step 1
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L26-L34
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
Step 2
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L69-L70
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
Step 3
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L119
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
add a comment |
See the core code:
Step 1
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L26-L34
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
Step 2
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L69-L70
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
Step 3
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L119
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
See the core code:
Step 1
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L26-L34
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
Step 2
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L69-L70
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
Step 3
https://github.com/magento/magento2/blob/02e0378c33054acb0cdb8d731d1e2b2c2069bc1b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php#L119
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
edited Nov 7 '16 at 8:53
Siarhey Uchukhlebau
9,33192757
9,33192757
answered Oct 26 '15 at 9:11
Mage2.PROMage2.PRO
3,54211218
3,54211218
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f87629%2fhow-do-you-call-blocks-in-controller-magento2%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
1
You should not call blocks in controller. Why do you need it?
– KAndy
Oct 26 '15 at 16:36