Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to call static block in magento ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 399
    Comment on it

    Hello Readers,
    Before i tell you how to call static block in magento. Lets understand the term "static block" & How to Create It..?

    Static blocks : Sometimes we are required to add some custom data or images (like banners) in the middle or anywhere of our pages in magento. To do this, we can use static block functionality in backend. These blocks make small changes to the section of a page.

     

    How to Create a static block in magento
    1. Login to your magento admin panel.
    2. Go to CMS Menu-> Click On Static blocks
    3. Click on Add new block
    4. Give block title of static block.
    5. Give identifier name to your block
    (Note: identifer name should be unique with no spaces ie “your_block_identifier” instead of “Your block identifer”
    6. Click Save Block button option to save your settings.

     

    How to call static block in your magento template or .phtml files

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

    How to call static block in any XML file

    <reference name="left">
        <block type="cms/block" name="myblock">
            <action method="setBlockId"><block_id>your_block_identifier</block_id></action>
        </block>    
    </reference>

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: