Magento 2 setTemplate and add content to phtml templateInclude phtml in magento CMSHow to change admin login template in Magento 1.5 or 1.6Add template block into another templateHow Can A Block Render Without Specifying `as` property of the block, When we use getChildHtml() MethodMagento 2 html file and phtml file in custom template process?Magento2: Add custom template to product details page below add to cart sectionAdd customer session object and use in templatesMagento 2 add custom data to checkoutMagento 2.2 can't override default templateHelp with overwriting .phtml file in Magento 2.2.7
What is the status of the F-1B engine development?
Why aren't rainbows blurred-out into nothing after they are produced?
Does the Fireball spell damage objects?
What is this "Table of astronomy" about?
How many people would you need to pull a whale over cobblestone streets?
Generate Brainfuck for the numbers 1–255
If "more guns less crime", how do gun advocates explain that the EU has less crime than the US?
How much maintenance time did it take to make an F4U Corsair ready for another flight?
How to create events observer that only call when REST api dispatch events?
Do beef farmed pastures net remove carbon emissions?
Plotting octahedron inside the sphere and sphere inside the cube
Understanding this peak detector circuit
When were the tantalum capacitors first used in computing?
Is it okay for a ticket seller in the USA to refuse to give you your change, keep it for themselves and claim it's a tip?
Email address etiquette - Which address should I use to contact professors?
What should I call bands of armed men in the Middle Ages?
Is there a standardised way to check fake news?
How to remove ambiguity: "... lives in the city of H, the capital of the province of NS, WHERE the unemployment rate is ..."?
Can sampling rate be a floating point number?
80's/90's superhero cartoon with a man on fire and a man who made ice runways like Frozone
Super Duper Vdd stiffening required on 555 timer, what is the best way?
Is it feasible to get a hash collision for CRC32, MD-5 and SHA-1 on one file?
How to divide item stack in MC PE?
These were just lying around
Magento 2 setTemplate and add content to phtml template
Include phtml in magento CMSHow to change admin login template in Magento 1.5 or 1.6Add template block into another templateHow Can A Block Render Without Specifying `as` property of the block, When we use getChildHtml() MethodMagento 2 html file and phtml file in custom template process?Magento2: Add custom template to product details page below add to cart sectionAdd customer session object and use in templatesMagento 2 add custom data to checkoutMagento 2.2 can't override default templateHelp with overwriting .phtml file in Magento 2.2.7
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to add bare HTML to a block e.g:
$block = $result->getLayout()->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml('<p>My Content</p>');
Is there a way to dynamically add content to a block perhaps without use of templates or any other way appreciate?
layout template magento2.2.2 template-override
add a comment |
How to add bare HTML to a block e.g:
$block = $result->getLayout()->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml('<p>My Content</p>');
Is there a way to dynamically add content to a block perhaps without use of templates or any other way appreciate?
layout template magento2.2.2 template-override
add a comment |
How to add bare HTML to a block e.g:
$block = $result->getLayout()->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml('<p>My Content</p>');
Is there a way to dynamically add content to a block perhaps without use of templates or any other way appreciate?
layout template magento2.2.2 template-override
How to add bare HTML to a block e.g:
$block = $result->getLayout()->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml('<p>My Content</p>');
Is there a way to dynamically add content to a block perhaps without use of templates or any other way appreciate?
layout template magento2.2.2 template-override
layout template magento2.2.2 template-override
edited Aug 1 at 11:19
Waqar Ali
59616 bronze badges
59616 bronze badges
asked Aug 1 at 11:04
Juliano VargasJuliano Vargas
7616 silver badges27 bronze badges
7616 silver badges27 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You should try this
echo $this->getLayout()->createBlock("VendorModuleBlockMyblock")-
>setTemplate("My_Module::history-suite.phtml")->toHtml();
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
add a comment |
I've found a solution pretty simple.
$block = $result->getLayout()->setData(['test'=> 'Content here'])->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml();
Then my blank.phtml
:
<?php print_r($this->getData()) ?>
It prints: Array ( [test] => Content here [module_name] => Magento_Catalog )
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%2f284079%2fmagento-2-settemplate-and-add-content-to-phtml-template%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
You should try this
echo $this->getLayout()->createBlock("VendorModuleBlockMyblock")-
>setTemplate("My_Module::history-suite.phtml")->toHtml();
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
add a comment |
You should try this
echo $this->getLayout()->createBlock("VendorModuleBlockMyblock")-
>setTemplate("My_Module::history-suite.phtml")->toHtml();
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
add a comment |
You should try this
echo $this->getLayout()->createBlock("VendorModuleBlockMyblock")-
>setTemplate("My_Module::history-suite.phtml")->toHtml();
You should try this
echo $this->getLayout()->createBlock("VendorModuleBlockMyblock")-
>setTemplate("My_Module::history-suite.phtml")->toHtml();
answered Aug 1 at 11:13
KHIMAJI VALUKIYAKHIMAJI VALUKIYA
415 bronze badges
415 bronze badges
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
add a comment |
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
I know that Not what I was looking for! however I've found a solution thanks.
– Juliano Vargas
Aug 1 at 11:15
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
please Upvote. If you appreciate.
– KHIMAJI VALUKIYA
Aug 1 at 11:18
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
Helpful for others not for me
– Juliano Vargas
Aug 1 at 11:19
add a comment |
I've found a solution pretty simple.
$block = $result->getLayout()->setData(['test'=> 'Content here'])->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml();
Then my blank.phtml
:
<?php print_r($this->getData()) ?>
It prints: Array ( [test] => Content here [module_name] => Magento_Catalog )
add a comment |
I've found a solution pretty simple.
$block = $result->getLayout()->setData(['test'=> 'Content here'])->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml();
Then my blank.phtml
:
<?php print_r($this->getData()) ?>
It prints: Array ( [test] => Content here [module_name] => Magento_Catalog )
add a comment |
I've found a solution pretty simple.
$block = $result->getLayout()->setData(['test'=> 'Content here'])->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml();
Then my blank.phtml
:
<?php print_r($this->getData()) ?>
It prints: Array ( [test] => Content here [module_name] => Magento_Catalog )
I've found a solution pretty simple.
$block = $result->getLayout()->setData(['test'=> 'Content here'])->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml();
Then my blank.phtml
:
<?php print_r($this->getData()) ?>
It prints: Array ( [test] => Content here [module_name] => Magento_Catalog )
answered Aug 1 at 11:18
Juliano VargasJuliano Vargas
7616 silver badges27 bronze badges
7616 silver badges27 bronze badges
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%2f284079%2fmagento-2-settemplate-and-add-content-to-phtml-template%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