11/12/2010

How to call a phtml file in magento cms page

You can't call a phtml file by writing php code in Magento admin panel as Magento admin panel doesn't support this. To call a PHTML write the folllowing code .

{{block type="core/template" name="a-name" template="cms/home.phtml"}}

inside template="" you can write your file path. and in name="" you can give proper and unique name , in type="" you can write your module directory also(e.g:- customer/account if you are calling login.phtml file).

One more way to call a phtml file. You can use your layout or xml file to do. For example i am going to attached home.phtml file which reside in cms folder of my thmeme template then I am writing the code given below

<reference name="content">
<block type="core/template" name="homepage" template="cms/homepage.phtml"/>
</reference>

1 comment: