Reputation: 41
I have created extension in magento 2 and i want to call content.phtml
file from static block (from admin panel). My content template file location is
C:\xampp\htdocs\Magento2\app/code\Surya\Slider\view\frontend\templates\content.phtml
where, magento2 is my project folder, Surya is vendor and Slider is my extension name. I want to call content.phtml
file on homepage through static block.
For that I have created one static block called as "slider". Also, i have created widget. But i want to call content.phtml file in static block.
Upvotes: 2
Views: 4941
Reputation: 153
If you would like to call template block in CMS static Block or CMS Page in Magento 2, then you can simply write the following code:
The skeleton code to understand :
{{block class="<vendor_name>\<module_name>\Block\<module_name>" name="<your_block_name>" template="<vendor_name>_<module_name>::<tempate_directory>/content.phtml"}}
Exact code :
{{block class="Surya\Slider\Block\Slider" name="slider" template="Surya_Slider::content.phtml"}}
Upvotes: 1
Reputation: 688
You can try the following code -
{{block class="Surya\Slider\Block\Slideshow" template="Surya_Slider::content.phtml"}}
Upvotes: 1
Reputation: 41
try below code :
{{block class="Surya\Slider\Block\Slideshow" template="Surya_Slider::content.phtml"}}
Upvotes: 2