Loading a .phtml file within an Observer Magento 2How can i rewrite TierPrice Block in Magento2magento 2...

What game did these black and yellow dice come from?

Is there a file that always exists and a 'normal' user can't lstat it?

What is the industry term for house wiring diagrams?

Does the US government have any planning in place to ensure there's no shortages of food, fuel, steel and other commodities?

How can I play a serial killer in a party of good PCs?

Does a paladin have to announce that they're using Divine Smite before attacking?

Methods for writing a code review

How to delete duplicate text from a file?

Does an Eldritch Knight's Weapon Bond protect him from losing his weapon to a Telekinesis spell?

What senses are available to a corpse subjected to a Speak with Dead spell?

Does the ditching switch allow an A320 to float indefinitely?

Do authors have to be politically correct in article-writing?

How can the probability of a fumble decrease linearly with more dice?

Why is 'diphthong' pronounced the way it is?

What species should be used for storage of human minds?

Why do neural networks need so many training examples to perform?

What language shall they sing in?

Are the positive and negative planes inner or outer planes in the Great Wheel cosmology model?

Non-Cancer terminal illness that can affect young (age 10-13) girls?

Confusion over units in force equation?

What does an unprocessed RAW file look like?

Eww, those bytes are gross

How vim overwrites readonly mode?

If angels and devils are the same species, why would their mortal offspring appear physically different?



Loading a .phtml file within an Observer Magento 2


How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?List Products of Categorywhen i click on category filter on Category List page Category filter getting error “Bucket does not exist”Invalid template file: 'Magehit_Bestsellerproducts::html/bestsellerblock.phtml'Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?













2















I'm trying to load my .phtml files in the template folder within my observer but I'm getting this error




Invalid template file: 'VENDOR_MYModule::Category/index.phtml' in module: 'VENDOR_MYModule' block's name: 'category_0'




Here's the structure of my files



app
+ code
+ VENDOR
+ MYModule
+ Block
- Category.php
+ Controller
+ Category
- Index.php
+ etc
+ frontend
- routes.xml
+ Observer
- CategoryObserver.php
+ view
+ frontend
+ layout
- header_category_index.xml
+ templates
+ category
- index.phtml


Now the content of my Block/Category.php is below



<?php
namespace VENDORMYModuleBlock;

class Category extends MagentoFrameworkViewElementTemplate
{
public function __construct(
MagentoBackendBlockTemplateContext $context,
array $data = []
){
parent::__construct($context, $data);
}

}


The content of my Controller/Category/Index.php is below



<?php
namespace VENDORMYModuleControllerCategory;

class Index extends MagentoFrameworkAppActionAction
{
protected $_pageFactory;

public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $pageFactory
)
{
$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}

public function execute()
{
return $this->_pageFactory->create();
}
}


The content of the layout/header_category_index.xml is below



<?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">
<referenceContainer name="content">
<block class="VENDORMYModuleBlockCategory" name="category_items" template="VENDOR_MYModule::category/index.phtml" />
</referenceContainer>
</page>


The content of my .phtml is just a simple <h1>Hello world</h1>. Now in my Observer I'm trying to load this .phtml file but I can't load it and getting the error. The content of my Observer ObserverCategoryObserver is below



public function execute(MagentoFrameworkEventObserver $observer)
{
$layout = $this->_layout->create();
$block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();

$this->_logger->debug("[DEBUG]::" , [$block]);
}


Here's the content of my events.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_category_save_after">
<observer name="category-edit" instance="VENDORMYModuleObserverCategoryObserver" />
</event>
</config>


But I'm getting the error as mentioned above. Any idea on how to load this .phtml file to the observer? I'm planning to write the content of this .phtml file to a .txt file. But I can't proceed since I tried outputting it but I'm still getting an error










share|improve this question





























    2















    I'm trying to load my .phtml files in the template folder within my observer but I'm getting this error




    Invalid template file: 'VENDOR_MYModule::Category/index.phtml' in module: 'VENDOR_MYModule' block's name: 'category_0'




    Here's the structure of my files



    app
    + code
    + VENDOR
    + MYModule
    + Block
    - Category.php
    + Controller
    + Category
    - Index.php
    + etc
    + frontend
    - routes.xml
    + Observer
    - CategoryObserver.php
    + view
    + frontend
    + layout
    - header_category_index.xml
    + templates
    + category
    - index.phtml


    Now the content of my Block/Category.php is below



    <?php
    namespace VENDORMYModuleBlock;

    class Category extends MagentoFrameworkViewElementTemplate
    {
    public function __construct(
    MagentoBackendBlockTemplateContext $context,
    array $data = []
    ){
    parent::__construct($context, $data);
    }

    }


    The content of my Controller/Category/Index.php is below



    <?php
    namespace VENDORMYModuleControllerCategory;

    class Index extends MagentoFrameworkAppActionAction
    {
    protected $_pageFactory;

    public function __construct(
    MagentoFrameworkAppActionContext $context,
    MagentoFrameworkViewResultPageFactory $pageFactory
    )
    {
    $this->_pageFactory = $pageFactory;
    return parent::__construct($context);
    }

    public function execute()
    {
    return $this->_pageFactory->create();
    }
    }


    The content of the layout/header_category_index.xml is below



    <?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">
    <referenceContainer name="content">
    <block class="VENDORMYModuleBlockCategory" name="category_items" template="VENDOR_MYModule::category/index.phtml" />
    </referenceContainer>
    </page>


    The content of my .phtml is just a simple <h1>Hello world</h1>. Now in my Observer I'm trying to load this .phtml file but I can't load it and getting the error. The content of my Observer ObserverCategoryObserver is below



    public function execute(MagentoFrameworkEventObserver $observer)
    {
    $layout = $this->_layout->create();
    $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();

    $this->_logger->debug("[DEBUG]::" , [$block]);
    }


    Here's the content of my events.xml



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_category_save_after">
    <observer name="category-edit" instance="VENDORMYModuleObserverCategoryObserver" />
    </event>
    </config>


    But I'm getting the error as mentioned above. Any idea on how to load this .phtml file to the observer? I'm planning to write the content of this .phtml file to a .txt file. But I can't proceed since I tried outputting it but I'm still getting an error










    share|improve this question



























      2












      2








      2








      I'm trying to load my .phtml files in the template folder within my observer but I'm getting this error




      Invalid template file: 'VENDOR_MYModule::Category/index.phtml' in module: 'VENDOR_MYModule' block's name: 'category_0'




      Here's the structure of my files



      app
      + code
      + VENDOR
      + MYModule
      + Block
      - Category.php
      + Controller
      + Category
      - Index.php
      + etc
      + frontend
      - routes.xml
      + Observer
      - CategoryObserver.php
      + view
      + frontend
      + layout
      - header_category_index.xml
      + templates
      + category
      - index.phtml


      Now the content of my Block/Category.php is below



      <?php
      namespace VENDORMYModuleBlock;

      class Category extends MagentoFrameworkViewElementTemplate
      {
      public function __construct(
      MagentoBackendBlockTemplateContext $context,
      array $data = []
      ){
      parent::__construct($context, $data);
      }

      }


      The content of my Controller/Category/Index.php is below



      <?php
      namespace VENDORMYModuleControllerCategory;

      class Index extends MagentoFrameworkAppActionAction
      {
      protected $_pageFactory;

      public function __construct(
      MagentoFrameworkAppActionContext $context,
      MagentoFrameworkViewResultPageFactory $pageFactory
      )
      {
      $this->_pageFactory = $pageFactory;
      return parent::__construct($context);
      }

      public function execute()
      {
      return $this->_pageFactory->create();
      }
      }


      The content of the layout/header_category_index.xml is below



      <?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">
      <referenceContainer name="content">
      <block class="VENDORMYModuleBlockCategory" name="category_items" template="VENDOR_MYModule::category/index.phtml" />
      </referenceContainer>
      </page>


      The content of my .phtml is just a simple <h1>Hello world</h1>. Now in my Observer I'm trying to load this .phtml file but I can't load it and getting the error. The content of my Observer ObserverCategoryObserver is below



      public function execute(MagentoFrameworkEventObserver $observer)
      {
      $layout = $this->_layout->create();
      $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();

      $this->_logger->debug("[DEBUG]::" , [$block]);
      }


      Here's the content of my events.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
      <event name="catalog_category_save_after">
      <observer name="category-edit" instance="VENDORMYModuleObserverCategoryObserver" />
      </event>
      </config>


      But I'm getting the error as mentioned above. Any idea on how to load this .phtml file to the observer? I'm planning to write the content of this .phtml file to a .txt file. But I can't proceed since I tried outputting it but I'm still getting an error










      share|improve this question
















      I'm trying to load my .phtml files in the template folder within my observer but I'm getting this error




      Invalid template file: 'VENDOR_MYModule::Category/index.phtml' in module: 'VENDOR_MYModule' block's name: 'category_0'




      Here's the structure of my files



      app
      + code
      + VENDOR
      + MYModule
      + Block
      - Category.php
      + Controller
      + Category
      - Index.php
      + etc
      + frontend
      - routes.xml
      + Observer
      - CategoryObserver.php
      + view
      + frontend
      + layout
      - header_category_index.xml
      + templates
      + category
      - index.phtml


      Now the content of my Block/Category.php is below



      <?php
      namespace VENDORMYModuleBlock;

      class Category extends MagentoFrameworkViewElementTemplate
      {
      public function __construct(
      MagentoBackendBlockTemplateContext $context,
      array $data = []
      ){
      parent::__construct($context, $data);
      }

      }


      The content of my Controller/Category/Index.php is below



      <?php
      namespace VENDORMYModuleControllerCategory;

      class Index extends MagentoFrameworkAppActionAction
      {
      protected $_pageFactory;

      public function __construct(
      MagentoFrameworkAppActionContext $context,
      MagentoFrameworkViewResultPageFactory $pageFactory
      )
      {
      $this->_pageFactory = $pageFactory;
      return parent::__construct($context);
      }

      public function execute()
      {
      return $this->_pageFactory->create();
      }
      }


      The content of the layout/header_category_index.xml is below



      <?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">
      <referenceContainer name="content">
      <block class="VENDORMYModuleBlockCategory" name="category_items" template="VENDOR_MYModule::category/index.phtml" />
      </referenceContainer>
      </page>


      The content of my .phtml is just a simple <h1>Hello world</h1>. Now in my Observer I'm trying to load this .phtml file but I can't load it and getting the error. The content of my Observer ObserverCategoryObserver is below



      public function execute(MagentoFrameworkEventObserver $observer)
      {
      $layout = $this->_layout->create();
      $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();

      $this->_logger->debug("[DEBUG]::" , [$block]);
      }


      Here's the content of my events.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
      <event name="catalog_category_save_after">
      <observer name="category-edit" instance="VENDORMYModuleObserverCategoryObserver" />
      </event>
      </config>


      But I'm getting the error as mentioned above. Any idea on how to load this .phtml file to the observer? I'm planning to write the content of this .phtml file to a .txt file. But I can't proceed since I tried outputting it but I'm still getting an error







      magento2 magento-2.1 magento2.2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 6 hours ago







      MadzQuestioning

















      asked 17 hours ago









      MadzQuestioningMadzQuestioning

      1354




      1354






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Change this line:



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();        


          to



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();        


          [Update]



          <?php
          namespace SRMagentoCommunityObserver;

          use MagentoFrameworkEventObserverInterface;
          use MagentoFrameworkEventObserver;

          class CatalogCategorySaveAfter implements ObserverInterface
          {
          private $layout;

          public function __construct(
          MagentoFrameworkViewLayout $layout
          ) {
          $this->layout = $layout;
          }

          public function execute(Observer $observer)
          {
          $block = $this->layout->createBlock('SRMagentoCommunityBlockCategory')->setTemplate('SR_MagentoCommunity::category/index.phtml')->toHtml();
          error_log($block);
          }
          }


          Template location:




          app/code/SR/MagentoCommunity/view/base/templates/category/index.phtml







          share|improve this answer


























          • I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

            – MadzQuestioning
            9 hours ago











          • Can you added observer full class and which event do you observe?

            – Sohel Rana
            7 hours ago











          • Updated my question

            – MadzQuestioning
            6 hours ago











          • Check updated answer

            – Sohel Rana
            30 mins ago



















          0














          $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();





          share|improve this answer
























          • How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

            – MadzQuestioning
            3 hours ago











          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%2f263353%2floading-a-phtml-file-within-an-observer-magento-2%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









          1














          Change this line:



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();        


          to



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();        


          [Update]



          <?php
          namespace SRMagentoCommunityObserver;

          use MagentoFrameworkEventObserverInterface;
          use MagentoFrameworkEventObserver;

          class CatalogCategorySaveAfter implements ObserverInterface
          {
          private $layout;

          public function __construct(
          MagentoFrameworkViewLayout $layout
          ) {
          $this->layout = $layout;
          }

          public function execute(Observer $observer)
          {
          $block = $this->layout->createBlock('SRMagentoCommunityBlockCategory')->setTemplate('SR_MagentoCommunity::category/index.phtml')->toHtml();
          error_log($block);
          }
          }


          Template location:




          app/code/SR/MagentoCommunity/view/base/templates/category/index.phtml







          share|improve this answer


























          • I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

            – MadzQuestioning
            9 hours ago











          • Can you added observer full class and which event do you observe?

            – Sohel Rana
            7 hours ago











          • Updated my question

            – MadzQuestioning
            6 hours ago











          • Check updated answer

            – Sohel Rana
            30 mins ago
















          1














          Change this line:



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();        


          to



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();        


          [Update]



          <?php
          namespace SRMagentoCommunityObserver;

          use MagentoFrameworkEventObserverInterface;
          use MagentoFrameworkEventObserver;

          class CatalogCategorySaveAfter implements ObserverInterface
          {
          private $layout;

          public function __construct(
          MagentoFrameworkViewLayout $layout
          ) {
          $this->layout = $layout;
          }

          public function execute(Observer $observer)
          {
          $block = $this->layout->createBlock('SRMagentoCommunityBlockCategory')->setTemplate('SR_MagentoCommunity::category/index.phtml')->toHtml();
          error_log($block);
          }
          }


          Template location:




          app/code/SR/MagentoCommunity/view/base/templates/category/index.phtml







          share|improve this answer


























          • I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

            – MadzQuestioning
            9 hours ago











          • Can you added observer full class and which event do you observe?

            – Sohel Rana
            7 hours ago











          • Updated my question

            – MadzQuestioning
            6 hours ago











          • Check updated answer

            – Sohel Rana
            30 mins ago














          1












          1








          1







          Change this line:



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();        


          to



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();        


          [Update]



          <?php
          namespace SRMagentoCommunityObserver;

          use MagentoFrameworkEventObserverInterface;
          use MagentoFrameworkEventObserver;

          class CatalogCategorySaveAfter implements ObserverInterface
          {
          private $layout;

          public function __construct(
          MagentoFrameworkViewLayout $layout
          ) {
          $this->layout = $layout;
          }

          public function execute(Observer $observer)
          {
          $block = $this->layout->createBlock('SRMagentoCommunityBlockCategory')->setTemplate('SR_MagentoCommunity::category/index.phtml')->toHtml();
          error_log($block);
          }
          }


          Template location:




          app/code/SR/MagentoCommunity/view/base/templates/category/index.phtml







          share|improve this answer















          Change this line:



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();        


          to



              $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();        


          [Update]



          <?php
          namespace SRMagentoCommunityObserver;

          use MagentoFrameworkEventObserverInterface;
          use MagentoFrameworkEventObserver;

          class CatalogCategorySaveAfter implements ObserverInterface
          {
          private $layout;

          public function __construct(
          MagentoFrameworkViewLayout $layout
          ) {
          $this->layout = $layout;
          }

          public function execute(Observer $observer)
          {
          $block = $this->layout->createBlock('SRMagentoCommunityBlockCategory')->setTemplate('SR_MagentoCommunity::category/index.phtml')->toHtml();
          error_log($block);
          }
          }


          Template location:




          app/code/SR/MagentoCommunity/view/base/templates/category/index.phtml








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 30 mins ago

























          answered 17 hours ago









          Sohel RanaSohel Rana

          21.9k34460




          21.9k34460













          • I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

            – MadzQuestioning
            9 hours ago











          • Can you added observer full class and which event do you observe?

            – Sohel Rana
            7 hours ago











          • Updated my question

            – MadzQuestioning
            6 hours ago











          • Check updated answer

            – Sohel Rana
            30 mins ago



















          • I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

            – MadzQuestioning
            9 hours ago











          • Can you added observer full class and which event do you observe?

            – Sohel Rana
            7 hours ago











          • Updated my question

            – MadzQuestioning
            6 hours ago











          • Check updated answer

            – Sohel Rana
            30 mins ago

















          I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

          – MadzQuestioning
          9 hours ago





          I tried this. I made the Category as capital because that's the name of the folder inside the template folder. I tried changing the name to small letter both from the file and the folder itself but I get the same error

          – MadzQuestioning
          9 hours ago













          Can you added observer full class and which event do you observe?

          – Sohel Rana
          7 hours ago





          Can you added observer full class and which event do you observe?

          – Sohel Rana
          7 hours ago













          Updated my question

          – MadzQuestioning
          6 hours ago





          Updated my question

          – MadzQuestioning
          6 hours ago













          Check updated answer

          – Sohel Rana
          30 mins ago





          Check updated answer

          – Sohel Rana
          30 mins ago













          0














          $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();





          share|improve this answer
























          • How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

            – MadzQuestioning
            3 hours ago
















          0














          $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();





          share|improve this answer
























          • How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

            – MadzQuestioning
            3 hours ago














          0












          0








          0







          $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();





          share|improve this answer













          $block = $layout->createBlock('VENDORMYModuleBlockCategory')->setTemplate('VENDOR_MYModule::category/index.phtml')->toHtml();






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 6 hours ago









          aravindaravind

          330113




          330113













          • How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

            – MadzQuestioning
            3 hours ago



















          • How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

            – MadzQuestioning
            3 hours ago

















          How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

          – MadzQuestioning
          3 hours ago





          How is this different from my sample? Aside from the difference of Upper Case C and lowercase C?

          – MadzQuestioning
          3 hours ago


















          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%2f263353%2floading-a-phtml-file-within-an-observer-magento-2%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

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...