Magento Cheat Sheet

I keep forgetting the syntax for Magento CMS, layout XML, and other little PHP snippets. So here we go:

Add a CMS block to another block via XML

<reference name="header">
    <block type="cms/block" name="store_banner" as="store_banner">
        <action method="setBlockId"><block_id>store_banner</block_id></action>
    </block>
</reference>

Source for an image in the skin directory from within a CMS page

<img src="{{skin url='images/image-name.jpg'}}" alt="Keyword loaded text!" />
Leave a Reply

Your email address will not be published. Required fields are marked *