toolman Posted August 11, 2011 Share Posted August 11, 2011 I currently have a drop down menu which displays categories, but i want them to display in equal columns horizontally. How could I do that using PHP? This is what I have: <div id="menu" class="grid_12"> <ul> <?php foreach ($categories as $category) { ?> <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> <?php if ($category['children']) { ?> <div class="sixth_color_border"> <?php for ($i = 0; $i < count($category['children']) { ?> <ul> <?php $j = $i + ceil(count($category['children']) / $category['column']); ?> <?php for (; $i < $j; $i++) { ?> <?php if (isset($category['children'][$i])) { ?> <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li> <?php } ?> <?php } ?> </ul> <?php } ?> </div> <?php } ?> </li> <div class="categories_spacer"></div> <?php } ?> </ul> </div> Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/244508-how-can-i-split-categories-into-equal-columns-in-this-menu/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.