Need Help with a Category Menu styling problem please

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 22, 2011   (RSS)

Re: [davidcmsb] Need Help with a Category Menu styling problem please

By davidcmsb - July 22, 2011

Follow up -- Eureka, with a little more fiddling I got it to work, using this code:

<ul>
<li><a href="?">(All Articles)</a></li>

<?php foreach ($categoriesRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>
<?php if ($categoryRecord['_hasChild'] && $categoryRecord['_isDescendantSelected']): ?>
<b><a href="#"><?php echo $categoryRecord['name'] ?></a></b>

<?php elseif ($categoryRecord['_hasChild']): ?>
<a href="#"><?php echo $categoryRecord['name'] ?></a>

<?php else: ?>

<?php if ($categoryRecord['_isSelected']): ?> <b> <?php endif ?>
<a href="?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?> </b><?php endif ?>

<?php endif ?>

<?php echo $categoryRecord['_listItemEnd'] ?>

<?php endforeach ?>

</ul>


I figured out that I needed to use an elseif, and structure it this way, with the most specific condition as the first IF, and then the more general as the ELSEIF, before then going on to everything else, i.e., [1] IF category menu item has a child and if a descendant is selected, then output null link and wrap in bold tag, or [2] ELSEIF category menu item has a child then output null link, otherwise [3] output the links and add bold tags if the item is the selected category.

So, I did get it working and thought I'd post this in case anyone thinks this is no good or there are better ways to do it. (Still haven't figured out the answer to what I posted about in my other post, about wrapping a <div> tag around the <ul> tags that CMSB adds around submenu items, so if anyone has any ideas, here is the link -- http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/How_to_have_%3Cdiv%3E_added_in_%3Cul%3E_category_menu_link_list_generated_by_CMSB_generated_P89145/)

Re: [davidcmsb] Need Help with a Category Menu styling problem please

By Jason - July 22, 2011

Hi,

Thanks for your post. Glad to hear that you've got everything working.

Please let us know if you run into any other issues. I'll be taking a look at your other forum post and will respond to it there.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/