Magento – Magento2: How to use block from another module in the custom module

blocksmagento2product-page

I've one third party extension which is adding addthis block on few pages.

I want to add addthis block on product page too.

<page layout="1column" xmlns:xsi="w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="urn:magento:framework:View/La‌​yout/etc/page_config‌​uration.xsd"> 
   <body> 
          <referenceContainer name="content"> <block class="Magefan\Blog\Block\Social\AddThis" name="addthis.js.init.new" template="Magefan_Blog::addthis-js.phtml" after="product.info.details" /> </referenceContainer> 
     </body> 
</page>

So I'm thinking to use the same block from that third party module. I've added that block definition in catalog_product_view.xml file in my custom module. But its not working. Can anyone help me please?

Best Answer

Remove unwanted character ; from <page .. tag,

<page xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/La‌​yout/etc/page_config‌​uration.xsd"> 
   <body> 
      <referenceContainer name="content">
          <block class="Magefan\Blog\Block\Social\AddThis" name="addthis.js.init.new" template="Magefan_Blog::addthis-js.phtml" after="product.info.details" />
      </referenceContainer> 
    </body> 
</page>

try this

Related Topic