Simple random banner rotator in Magento using static blocks
1.SomeBannerIdentifierName_1
2.SomeBannerIdentifierName_2
3.SomeBannerIdentifierName_3
4....
5.SomeBannerIdentifierName_N
For each content use this:
Please note that you are not restricted only to images, you could use text, video or whatever you want here, but I’ll focus on images with links as title says.
Now when all is set, make new file called banner_rotator.phtml in “/app/design/frontend/YOUR_INTERFACE/YOUR_THEME/template/callouts/banner_rotator.phtml”
And use this code inside:
< ?php
echo $this->getLayout()->createBlock(’cms/block’)->setBlockId(’SomeBannerIdentifierName_’.mt_rand(1, N))->toHtml() ?>
*Make sure you replace “N” with highest number of your static block
In order to show this block, you should be familiar with Magento layouts.
Since that is out of scope for this article, I’ll show you how to put it below the content on cms pages.
Open “/app/design/frontend/YOUR_INTERFACE/YOUR_THEME/layout/cms.xml”
[*] Put this line:
P U T [*] H E R E ! ! !
ref: http://inchoo.net/ecommerce/magento/simple-random-banner-rotator-in-magento-using-static-blocks/

