Thứ Tư, 6 tháng 10, 2010

Calling a static block into phtml file in Magento

To call a static block in Magento ,You can use the following code;


<?php

echo $this->getLayout()->createBlock('cms/block')->setBlockId('Your_Static_Block_Name')->toHtml();

?>


To create your Static Block you can log into your admin panel than go to CMS->Static Blocks. There create your static Block with a name, then write the name in setBlockId() to call that into phtml file.

Không có nhận xét nào:

Đăng nhận xét