Help with category dropdown

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 5, 2012   (RSS)

I try to use dropdown menu but i need help..

this is my code:

<ul>
<li>
<a href="#" target="_self"><font class="leaf">Home</font></a>
</li>
<li>
<a href="#" target="_self"><span class="branch">Company</span><!--[if gt IE 6]><![endif] --></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li>
<a href="#" target="_self"><font class="leaf">About Us</font></a>
</li>
<li>
<a href="#" target="_self"><font class="leaf">Terms of use</font></a>
</li>
<li>
<a href="#" target="_self"><font class="leaf">Press Releases</font></a>
</li>
</ul><!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<li>
<a href="#" target="_self"><font class="leaf">About</font></a>
</li>
<li>
<a href="#" target="_self"><font class="leaf">Contact</font></a>
</li>
</ul>


How can i do it dynamic with our category in CMS

Thanks,
Efi

Re: [Tom P] Help with category dropdown

By efi-revivo - January 5, 2012 - edited: January 5, 2012

Ok, I did it :-)
now its work great..

<div id="container" class="container" dir="rtl">
<ul id="shita" class="shita">
<!-- version=1.0.239;name=shita;baseskin=glossy;colorscheme=shitanew;type=dropdown; -->
<?php $divToClose = false; ?>
<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php if ($categoryRecord['depth'] == 0): ?>
<?php if ($divToClose): ?>
<?php $divToClose = false; ?>
</ul></li>
<?php endif ?>
<?php if ($categoryRecord['_hasChild']): ?>
<?php $divToClose = true; ?>
<li>
<a href="#"><span class="branch"><?php echo $categoryRecord['name'] ?></span></a>
<ul>
<?php else: ?>
<li>
<a href="#"><?php echo $categoryRecord['name'] ?></a>
</li>
<?php endif ?>
<?php else: ?>
<li><a href="#"><?php echo $categoryRecord['name'] ?></a></li>
<?php endif ?>


<?php endforeach ?>
<?php if ($divToClose): ?>
<?php endif ?>
</ul>

</div>