Magento::Custom Block not working in Homepage -
in magento want show static block in homepage only.
i tried solution mentioned in this question didn't work.
i added code, in page.xml file, , started giving error, cut , put in local.xml file:
<cms_index_index> <reference name="content"> <block type="cms/block" name="home-page-block"> <action method="setblockid"><block_id>home-page-block</block_id></action> </block> </reference> <cms_index_index> it didn't give error, still doesn't show static block. entered in 2columns-right.phtml file, though think wasn't required.
<?php echo $this->getchildhtml('home-page-block') ?> but still didn't work. can point out missing?
one of easiest thing <?php $homepageurl = mage::getbaseurl(); //this gets domain name sort of $currenturl = $this->helper('core/url')->getcurrenturl(); // gets current url //you can conditional stuff in here if($currenturl == $homepageurl) : ?> //then display block calling block <div style="margin: 0 auto; width: 100%; max-width: 1180px;"> <?php echo $this->getlayout() ->createblock('cms/block') ->setblockid('seo-homepage') ->tohtml(); ?> </div> <?php endif; ?>
Comments
Post a Comment