Reputation: 3554
Hi I need in my project to show the CMS pages link dynamically in header,
Can anybody suggest me How I can do this ?
Upvotes: 0
Views: 940
Reputation: 3554
with this code we can show magento cms page dynamically in magento navigation which have status enabled. We just need to place this code in header or in topnav file
<?php $collection = Mage::getModel('cms/page')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());?>
<?php $collection->getSelect()->where('is_active = 1'); ?>
<ul id="nav">
<?php foreach ($collection as $page): ?>
<?php $PageData = $page->getData(); ?>
<?php// print_r($PageData);?>
<?php if($PageData['identifier']!='no-route' && $PageData['identifier']!='enable-cookies' && $PageData['identifier']!='home2') { ?>
<li>
<a href="/magento/index.php/<?php echo $PageData['identifier']?>"><span><?php echo $PageData['title'] ?></span></a>
</li>
<?php } ?>
<?php endforeach; ?>
</ul>
Upvotes: 1