Google+

Pages

Wednesday, July 4, 2012

How to call .phtml file in CMS page in magento

To call a phtml file in a cms page or cms static block:

{{block type="core/template" template="templateFolder/your_template.phtml"}}

If you know, where the block file(php file) for your phtml file resides, then you can use it as type.

Example: Suppose you want to call new.phtml file that resides in catalog/product folder, and you know that its corresponding Block file(php file) resides in Catalog/Product folder, then you can use:

{{block type="catalog/product" template="catalog/product/new.phtml"}}

2 comments:

Anonymous said...

{{block type="catalog/product" template="catalog/product/new.phtml"}}


I have Understood the location of catalog/product/new.phtml within the template,but what is location of :
block type="catalog/product" i.e
what does it actually mean?? Can You explain it?

Unknown said...

This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
magento development company in bangalore This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
magento development company in bangalore This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
magento development company in bangalore