Friday, March 23, 2012

Magento 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 in the page which you have created under CMS



{{block type="core/template" name="a-name" template="yourfoldernmae/yourfilename.phtml"}}
Code explaination 
template="" you can write your file path.
name=""  you can give proper and unique name
type=""  you can write your module directory also  or {{block type="core/template" ....}}

(e.g:- catalog/product if you are calling list.phtml file) OR

One more way to call a phtml file. You can use your layout or xml file to do.

For example we are going to attached yourfilename.phtml file which reside in yourfoldernmae folder
app->design->frontend->yourtheme->youfolder->yourfile

<reference name="content">
<block type="core/template" name="a-name" template="yourfoldernmae/yourfilename.phtml"/>
</reference>
Hope this will help you!

No comments:

Post a Comment

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...