If you are in header.phtml file then you can call $this->getIsHomepage();
But if you are not there then you must have to create instance of Mage_Page_Block_Html_Header(); then write the following code to check homepage
<?php
$ref = new Mage_Page_Block_Html_Header();
if($ref->getIsHomePage()){ ?>
<div class="homepage"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('Your_StaticBlock_Id')->toHtml();?></div>
<?php
}
?>
thanks!!
ReplyDeleteCan you tell me how the oppossite works. So to show a block every where on the store accept on the homepage.
ReplyDeleteyou can do by if(!$ref->getIsHomePage()){}
DeleteHi,
ReplyDeleteIt is working fine, but i have three languages and when i change language from home page this static not showing there.
working on: http://127.0.0.1/magento-1.7.0.2-fashiono/magento/index.php
not working on: http://127.0.0.1/magento-1.7.0.2-fashiono/magento/index.php/?___store=french&___from_store=default
can you please help.
Thanks, paddy
Thanx Lot...
ReplyDeleteTHANKS!
ReplyDelete$ref->getIsHomePage() is not working
ReplyDeleteUsed it for banner slider on homepage. Thanks
ReplyDelete