Magento Theme – How to Set Template in Block for Current Theme

blockslayouttemplatetheme

I have set template using the following code

$this->getLayout()->createBlock('core/template')->setTemplate('catalogsearch/for‌​m.mini.phtml')->toHtml();

This calls the template file from the following folder frontend/base/default/template/catalogsearch/for‌​m.mini.phtml.

How can I call this from my custom theme (i.e.) frontend/customtheme/default/template/catalogsearch/for‌​m.mini.phtml ?

Best Answer

if you have configured your package/theme correctly in backend (at System > Configuration > Design), then Magento will automatically take your phtml file from your package\theme if you have defined your phtml file correctly there.

Magento uses a callback mechanism to fetching the correct file. It first look for a theme file in the configured package/theme directory, then the default theme directory (if any) and at last in the base/default directory.

So your file is taking from base/default directory means, you didnt defined catalogsearch/for‌​m.mini.phtml in your theme directory correctly. So check again the template file path and then clear the cache.

Related Topic