Satheesh Narayanan
Satheesh Narayanan

Reputation: 321

Magento block file is not showing up some times

Catalog.xml

<default>
    <!-- Mage_Catalog -->
    <reference name="top.menu">
        <block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml">
          <block type="catalog/navigation" name="topnav_extra" template="catalog/navigation/top_extra.phtml" />
        </block>
    </reference>

top_extra.phtml

<ul>
<li> Custom Menu1 </li>
<li> Custom Menu2 </li>
</ul>

top.phtml

<?php if($_menu): ?>
<ul id="topnav">
    <?php echo $_menu ?>
    <!-- Header Menu laset tab start here --> 
<?php  echo $this->getChildHtml('topnav_extra');  ?>
</ul>

This block is not showing sometimes when i refreshing twice or thrice it's coming. I am doing reindexing and cache refreshing on daily using cron. But i dont know why its coming randomly?

Upvotes: 0

Views: 210

Answers (2)

Satheesh Narayanan
Satheesh Narayanan

Reputation: 321

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/navigation/top_extra.phtml')->toHtml(); ?>

i include that file with out layout handles. I am not sure is the right way to do this? but its showing up. I put log to know how many times its not showing up.. Will see

Upvotes: 0

djthoms
djthoms

Reputation: 3106

That sounds like a caching issue to me. Try calling your custom menu via PHP instead of XML

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

This will alleviate any issues you might encounter using the XML files. Hope this helps!

Upvotes: 1

Related Questions