Scriptbaker
SCRIPTBAKERAI & Software Engineering
Magento

Magento: Render static block in a phtml file

Suppose you have created a static block from Magento administration panel (CMS -> Static Blocks) and you want to render its content in some phtml file. [source

· 5 min read

Suppose you have created a static block from Magento administration panel (CMS -> Static Blocks) and you want to render its content in some phtml file.

 <?php echo $this->getLayout()->createBlock('cms/block') ->setBlockId('footer_links') ->toHtml(); ?> 

Above code will load the static block by its identifier “footer_links”, then produces and returns block’s html output.

S

Scriptbaker Editorial Team

The Scriptbaker editorial team comprises engineers, AI specialists, and digital strategists based in Dubai and Rawalpindi. We write about software development, artificial intelligence, and digital transformation to help organisations build better products. Learn more about us →