Rendering Html content for Header Block Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraMagento 1.8 - Display block in email templateLayout XML block rendered twice in Magento skinHow to call widget with products of specific category in “.phtml” file?How to call widget with products of specific category in “.phtml” file?Magento 2: Add block above page-headerHeader links BlockMake sticky header for Magento 2 problemHow to call static block into a phtml file Magento 2Remove Default header and create new one with menu and search barcall breadcrumbs block twice in page.xml magento 1.9
Vigenère cipher in Ruby
Is Electric Central Heating worth it if using Solar Panels?
Are these square matrices always diagonalisable?
Is there any hidden 'W' sound after 'comment' in : Comment est-elle?
Expansion//Explosion and Siren Stormtamer
How to use @AuraEnabled base class method in Lightning Component?
What is /etc/mtab in Linux?
All ASCII characters with a given bit count
Passing args from the bash script to the function in the script
How would I use different systems of magic when they are capable of the same effects?
What’s with the clanks in Endgame?
c++ diamond problem - How to call base method only once
Is it OK if I do not take the receipt in Germany?
What was Apollo 13's "Little Jolt" after MECO?
How to get even lighting when using flash for group photos near wall?
PIC mathematical operations weird problem
Co-worker works way more than he should
A strange hotel
What is this word supposed to be?
How to not starve gigantic beasts
Do I need to protect SFP ports and optics from dust/contaminants? If so, how?
What is a 'Key' in computer science?
What to do with someone that cheated their way through university and a PhD program?
Multiple fireplaces in an apartment building?
Rendering Html content for Header Block
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraMagento 1.8 - Display block in email templateLayout XML block rendered twice in Magento skinHow to call widget with products of specific category in “.phtml” file?How to call widget with products of specific category in “.phtml” file?Magento 2: Add block above page-headerHeader links BlockMake sticky header for Magento 2 problemHow to call static block into a phtml file Magento 2Remove Default header and create new one with menu and search barcall breadcrumbs block twice in page.xml magento 1.9
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to get my header part as html and I will use this in some other site with Api call. For that I am trying to render using the MagentoThemeBlockHtmlHeader
block. I am using the following code. But it is not working. Some one please suggest me to correct this or some other method to implement.
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->setTemplate('Magento_Theme::html/header.phtml')->toHtml();
magento2 blocks
add a comment |
I want to get my header part as html and I will use this in some other site with Api call. For that I am trying to render using the MagentoThemeBlockHtmlHeader
block. I am using the following code. But it is not working. Some one please suggest me to correct this or some other method to implement.
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->setTemplate('Magento_Theme::html/header.phtml')->toHtml();
magento2 blocks
what you getting by this code?
– kunj
Jun 8 '18 at 11:20
I am getting the error likeInvalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 11:38
try without template$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->toHtml();
– kunj
Jun 8 '18 at 12:15
I am trying to do this also, but I've got an empty string as result. Did you solved it?
– vaso123
Mar 21 at 10:59
add a comment |
I want to get my header part as html and I will use this in some other site with Api call. For that I am trying to render using the MagentoThemeBlockHtmlHeader
block. I am using the following code. But it is not working. Some one please suggest me to correct this or some other method to implement.
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->setTemplate('Magento_Theme::html/header.phtml')->toHtml();
magento2 blocks
I want to get my header part as html and I will use this in some other site with Api call. For that I am trying to render using the MagentoThemeBlockHtmlHeader
block. I am using the following code. But it is not working. Some one please suggest me to correct this or some other method to implement.
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->setTemplate('Magento_Theme::html/header.phtml')->toHtml();
magento2 blocks
magento2 blocks
edited Jun 8 '18 at 11:41
sabarivenkatesankrish
asked Jun 8 '18 at 11:13
sabarivenkatesankrishsabarivenkatesankrish
19110
19110
what you getting by this code?
– kunj
Jun 8 '18 at 11:20
I am getting the error likeInvalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 11:38
try without template$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->toHtml();
– kunj
Jun 8 '18 at 12:15
I am trying to do this also, but I've got an empty string as result. Did you solved it?
– vaso123
Mar 21 at 10:59
add a comment |
what you getting by this code?
– kunj
Jun 8 '18 at 11:20
I am getting the error likeInvalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 11:38
try without template$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->toHtml();
– kunj
Jun 8 '18 at 12:15
I am trying to do this also, but I've got an empty string as result. Did you solved it?
– vaso123
Mar 21 at 10:59
what you getting by this code?
– kunj
Jun 8 '18 at 11:20
what you getting by this code?
– kunj
Jun 8 '18 at 11:20
I am getting the error like
Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 11:38
I am getting the error like
Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 11:38
try without template
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->toHtml();
– kunj
Jun 8 '18 at 12:15
try without template
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->toHtml();
– kunj
Jun 8 '18 at 12:15
I am trying to do this also, but I've got an empty string as result. Did you solved it?
– vaso123
Mar 21 at 10:59
I am trying to do this also, but I've got an empty string as result. Did you solved it?
– vaso123
Mar 21 at 10:59
add a comment |
2 Answers
2
active
oldest
votes
Try this code :
<?php echo $this->getLayout()->createBlock("MagentoThemeBlockHtmlFooter")->setTemplate("Magento_Theme::html/footer.phtml")->toHtml();?>
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
add a comment |
Can't you use $block
for any reason instead of $this->_view
?
update
One more thing, template path should use / instead of
Magento_Theme::html/header.phtml
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
Actually I was used the template asMagento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash
– sabarivenkatesankrish
Jun 8 '18 at 11:44
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
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%2f229193%2frendering-html-content-for-header-block%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
Try this code :
<?php echo $this->getLayout()->createBlock("MagentoThemeBlockHtmlFooter")->setTemplate("Magento_Theme::html/footer.phtml")->toHtml();?>
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
add a comment |
Try this code :
<?php echo $this->getLayout()->createBlock("MagentoThemeBlockHtmlFooter")->setTemplate("Magento_Theme::html/footer.phtml")->toHtml();?>
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
add a comment |
Try this code :
<?php echo $this->getLayout()->createBlock("MagentoThemeBlockHtmlFooter")->setTemplate("Magento_Theme::html/footer.phtml")->toHtml();?>
Try this code :
<?php echo $this->getLayout()->createBlock("MagentoThemeBlockHtmlFooter")->setTemplate("Magento_Theme::html/footer.phtml")->toHtml();?>
answered Jun 8 '18 at 11:21
user68116
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
add a comment |
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
Hi, as I mentioned in the post, this is to be implemented as Api. I can't use $this class in model or even in controller to get the layout
– sabarivenkatesankrish
Jun 8 '18 at 11:40
add a comment |
Can't you use $block
for any reason instead of $this->_view
?
update
One more thing, template path should use / instead of
Magento_Theme::html/header.phtml
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
Actually I was used the template asMagento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash
– sabarivenkatesankrish
Jun 8 '18 at 11:44
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
add a comment |
Can't you use $block
for any reason instead of $this->_view
?
update
One more thing, template path should use / instead of
Magento_Theme::html/header.phtml
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
Actually I was used the template asMagento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash
– sabarivenkatesankrish
Jun 8 '18 at 11:44
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
add a comment |
Can't you use $block
for any reason instead of $this->_view
?
update
One more thing, template path should use / instead of
Magento_Theme::html/header.phtml
Can't you use $block
for any reason instead of $this->_view
?
update
One more thing, template path should use / instead of
Magento_Theme::html/header.phtml
edited Jun 8 '18 at 11:35
answered Jun 8 '18 at 11:23
Raul SanchezRaul Sanchez
2,18931335
2,18931335
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
Actually I was used the template asMagento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash
– sabarivenkatesankrish
Jun 8 '18 at 11:44
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
add a comment |
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
Actually I was used the template asMagento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash
– sabarivenkatesankrish
Jun 8 '18 at 11:44
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
particular reason for using the $this->_view, as mentioned in the post I am going to use this as API. So I need to get the html in model. In model it is not possible to use $block->getLayout() or $this->getLayout().
– sabarivenkatesankrish
Jun 8 '18 at 11:43
Actually I was used the template as
Magento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash– sabarivenkatesankrish
Jun 8 '18 at 11:44
Actually I was used the template as
Magento_Theme::html/header.phtml
. But in the post only by mistake I put the back slash– sabarivenkatesankrish
Jun 8 '18 at 11:44
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
which error do you see? or it just doesn't print anything? any info in var/log files?
– Raul Sanchez
Jun 8 '18 at 12:38
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Yes, I am getting the error like Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 12:57
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
Try setting just html/header.phtml, without specifying module
– Raul Sanchez
Jun 8 '18 at 13:13
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%2f229193%2frendering-html-content-for-header-block%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
what you getting by this code?
– kunj
Jun 8 '18 at 11:20
I am getting the error like
Invalid template file: 'Magento_Theme::html/footer.phtml' in module: 'Magento_Theme' block's name: 'html\footer_0'
– sabarivenkatesankrish
Jun 8 '18 at 11:38
try without template
$this->_view->getLayout()->createBlock('MagentoThemeBlockHtmlHeader')->toHtml();
– kunj
Jun 8 '18 at 12:15
I am trying to do this also, but I've got an empty string as result. Did you solved it?
– vaso123
Mar 21 at 10:59