cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2: How to call PHP file in another phtml file inside the module?

Magento 2: How to call PHP file in another phtml file inside the module?

I am using magefan blog extension, i want to move post page bottom section related product to sidebar

 

Screenshot : https://i.stack.imgur.com/MDYCd.png

 

The related product php file under \app\code\Magefan\Blog\Block\Post\View\RelatedProducts.php how to call this file into side bar section?

1 REPLY 1

Re: Magento 2: How to call PHP file in another phtml file inside the module?

Hello @Aveeva ,

 

Although you have to dig your code, but roughly speaking, you have to find the layout file of blog landing page, and then need to cut the element code which is rendering the related products block and then paste that code inside sidebar(or you need to find the container of sidebar and add that block on first by use of referenceContainer or referenceBlock).

ps : nice arrow in screenshot ! Smiley Very Happy

 

Hope it helps !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy