Hi,
I want to use the category menu list of links to categories that CMSB generates with a menu script. This menu script is a Dreamweaver extension that generates the <ul> list like this:
div id="p7TMM_1" class="p7TMM04">
81 <ul class="p7TMM">
82 <li><a href="#">Root Menu Item</a>
83 <div>
84 <ul>
85 <li><a href="#">Menu Item</a></li>
86 <li><a href="#">Menu Item</a></li>
87 <li><a href="#">Menu Item</a></li>
88 </ul>
89 </div>
90 </li>
91 <li><a href="#">Root Menu Item</a>
92 <div>
93 <ul>
94 <li><a href="#">Menu Item</a></li>
95 <li><a href="#">Menu Item</a>
96 <div>
97 <ul>
98 <li><a href="#">Menu Item</a></li>
99 <li><a href="#">Menu Item</a></li>
100 <li><a href="#">Menu Item</a></li>
101 </ul>
102 </div>
103 </li>
104 <li><a href="#">Sub-Menu Item</a></li>
105 <li><a href="#">Sub-Menu Item</a></li>
106 </ul>
107 </div>
108 </li>
109 <li><a href="#">Root Menu Item</a>
110 <div>
111 <ul>
112 <li><a href="04carbon.htm">Current Mark</a></li>
113 <li><a href="#">Menu Item</a></li>
114 <li><a href="#">Menu Item</a></li>
115 </ul>
116 </div>
117 </li>
118 <li><a href="#">Root Menu Item</a>
119 <div>
120 <ul>
121 <li><a href="#">Menu Item</a></li>
122 <li><a href="#">Menu Item</a></li>
123 <li><a href="#">Menu Item</a></li>
124 </ul>
125 </div>
126 </li>
127 </ul>
128 <!--[if lte IE 6]>
129<style>.p7TMM04 .p7TMM, .p7TMM04 a, .p7TMM04 li {height:1%;}</style>
130<![endif]-->
131 <!--[if IE 5]>
132<style>.p7TMM04 a, .p7TMM04 a {overflow: visible !important;}</style>
133<![endif]-->
134 <script type="text/javascript">
135<!--
136P7_TMMop('p7TMM_1',3,0,0,3,1,1,1,0,-1,150);
137//-->
138 </script>
As you can see, it wraps submenu <ul>'s in <div> tags (see, e.g., lines 83 & 89, 92 & 107, and 96 & 102, above).
I think I can add the first opening <div> by using the __hasChild function by using perhaps something like this which adds the div after the link if the category record has a child, for example this --
<ul>
<li><a href="?">(All Articles)</a></li>
<?php foreach ($categoriesRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>
<?php if ($categoryRecord['_hasChild']): ?>
<a href="#"><?php echo $categoryRecord['name'] ?></a> <div>
<?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 echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach ?>
</ul>
BUT I just can't figure out after wrestling with it a long time just how to add the ending </div> tag. Something using _isLastChild perhaps, but I just can't figure out the exact code needed. And, it has to go after the </ul> tag that CMSB seems to auto generate to end the sub menu <ul>'s inside the main <ul>.
So, what I need is the code that will generate the category links in the format as per that used by the menu script I want to use as shown above that will add the necessary <div> and </div> surrounding the <ul></ul> pairs that get generated for sub menus (and sub sub menus etc.).
Thanks very much.