Wednesday, 6 June 2012

How to call static block in magento

=> Login in into your magento admin panel.
=> Navigate to CMS->Static blocks
=> Click Add new block
=> Give your block title (Title: A descriptive name to identify this block)
=> Give your block identifier (Identifier: The identifer will allow you to call this block from your template files or using the Magento markup tags. Typically this would be programmer friendly name with no spaces or punctuation ie “my_block_identifier” rather than “My block’s identifer!”)
=> Set status enabled (Status: Here you can enable or disable a block.)
=> Entere your block content field (Content: As well as standard HTML you can also include special Magento markup tags in the block content. You can find information about these tags on the markup tags wiki page.)
=> Click Save Block or Save and Continue Edit to save your settings.

How to call image in static block

{{skin url='images/media/about_us_img.jpg'}}

How to creating a link to another page within your site

{{store direct_url='mypage.html'}}

How to call staic block any XML file

<reference name="left">
    <block type="cms/block" name="sample_block" before="-">
        <action method="setBlockId"><block_id>sample_block</block_id></action>
    </block>
</reference>

How to call staick block in your template or .phtml files

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

How to call static block in CMS->Pages

{{block type="cms/block" block_id="your_block_id"}}

3 comments:

  1. thats very good post.awesome.

    ReplyDelete
  2. Thanks for sharing this information. I found it very informative as I have been researching a lot lately on practical matters such as you talk about..
    affordable custom web design

    ReplyDelete
  3. 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 

    ReplyDelete

Note: only a member of this blog may post a comment.