Magento 2 : How to get static block as html content on frontpage? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How get a static block content based on its title not identifier?Calling a Static-Block in a CMS-Page is not workingmagento 2: display cms static page content in phtml fileWhy does html code appear in frontend content of static block?magento 2 : how to use phtml in cms static blockHow to call widget with products of specific category in “.phtml” file?How to call widget with products of specific category in “.phtml” file?How to show static block just below navigation?How insert CMS static block Top Menu Magento 2.x?How to call static block into a phtml file Magento 2

Can withdrawing asylum be illegal?

Using dividends to reduce short term capital gains?

Circular reasoning in L'Hopital's rule

Are spiders unable to hurt humans, especially very small spiders?

When did F become S? Why?

"... to apply for a visa" or "... and applied for a visa"?

What information about me do stores get via my credit card?

What force causes entropy to increase?

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

What can I do if neighbor is blocking my solar panels intentionally?

Button changing its text & action. Good or terrible?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Keeping a retro style to sci-fi spaceships?

Mortgage adviser recommends a longer term than necessary combined with overpayments

Am I ethically obligated to go into work on an off day if the reason is sudden?

How to read αἱμύλιος or when to aspirate

Why doesn't a hydraulic lever violate conservation of energy?

Why can't devices on different VLANs, but on the same subnet, communicate?

Did the new image of black hole confirm the general theory of relativity?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

Can I visit the Trinity College (Cambridge) library and see some of their rare books

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

60's-70's movie: home appliances revolting against the owners

Sub-subscripts in strings cause different spacings than subscripts



Magento 2 : How to get static block as html content on frontpage?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How get a static block content based on its title not identifier?Calling a Static-Block in a CMS-Page is not workingmagento 2: display cms static page content in phtml fileWhy does html code appear in frontend content of static block?magento 2 : how to use phtml in cms static blockHow to call widget with products of specific category in “.phtml” file?How to call widget with products of specific category in “.phtml” file?How to show static block just below navigation?How insert CMS static block Top Menu Magento 2.x?How to call static block into a phtml file Magento 2



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















As we know that we're able to render html content up in front as using below code



echo $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();


but as I require to display as html content.



For eg: <div>This is static Block </div>



Like this up in front.










share|improve this question






















  • Do you want to use this in checkout ?

    – Manashvi Birla
    Apr 9 at 6:38

















0















As we know that we're able to render html content up in front as using below code



echo $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();


but as I require to display as html content.



For eg: <div>This is static Block </div>



Like this up in front.










share|improve this question






















  • Do you want to use this in checkout ?

    – Manashvi Birla
    Apr 9 at 6:38













0












0








0








As we know that we're able to render html content up in front as using below code



echo $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();


but as I require to display as html content.



For eg: <div>This is static Block </div>



Like this up in front.










share|improve this question














As we know that we're able to render html content up in front as using below code



echo $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();


but as I require to display as html content.



For eg: <div>This is static Block </div>



Like this up in front.







magento2 static-block html block-html






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 9 at 6:25









Prathap GunasekaranPrathap Gunasekaran

1,8251618




1,8251618












  • Do you want to use this in checkout ?

    – Manashvi Birla
    Apr 9 at 6:38

















  • Do you want to use this in checkout ?

    – Manashvi Birla
    Apr 9 at 6:38
















Do you want to use this in checkout ?

– Manashvi Birla
Apr 9 at 6:38





Do you want to use this in checkout ?

– Manashvi Birla
Apr 9 at 6:38










1 Answer
1






active

oldest

votes


















1














You may try this



$blockHtml = $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();
echo $block->escapeHtml($blockHtml);





share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269290%2fmagento-2-how-to-get-static-block-as-html-content-on-frontpage%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You may try this



    $blockHtml = $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();
    echo $block->escapeHtml($blockHtml);





    share|improve this answer



























      1














      You may try this



      $blockHtml = $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();
      echo $block->escapeHtml($blockHtml);





      share|improve this answer

























        1












        1








        1







        You may try this



        $blockHtml = $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();
        echo $block->escapeHtml($blockHtml);





        share|improve this answer













        You may try this



        $blockHtml = $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('identifier')->toHtml();
        echo $block->escapeHtml($blockHtml);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 9 at 6:58









        Pritam Info 24Pritam Info 24

        79217




        79217



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269290%2fmagento-2-how-to-get-static-block-as-html-content-on-frontpage%23new-answer', 'question_page');

            );

            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







            Popular posts from this blog

            Sum ergo cogito? 1 nng

            419 nièngy_Soadمي 19bal1.5o_g

            Queiggey Chernihivv 9NnOo i Zw X QqKk LpB