3

I have created extension in Magento 2 and i want to call index.phtml file from static block (from admin panel). Module structure

Ashore>Faq>Block>Faq>Index.phtml

Ashore>Faq>View>frontend>Templates>faq>index.phtml

how can i call?

0

3 Answers 3

7
{{block class="<vendor_name>\<module_name>\Block\<module_name>" name="<your_block_name>" template="<vendor_name>_<module_name>::<template_directory>/filename.phtml"}}

In your case it is look like

{{block class="Ashore\Faq\Block\Faq\Index" name="Faq" template="Ashore_Faq::faq/index.phtml"}}
0
2

You can Use this to call template file in static block

{{block class="Block Name" template="PackageName_ ModuleName::phtml file name"}}
2

You can call your .phtml file in CMS page like below

{{block class="Ashore\Faq\Block\Faq\Index" name="faq" template="Ashore_Faq::faq/index.phtml"}}

Not the answer you're looking for? Browse other questions tagged or ask your own question.