导航php菜单到bootstrap

时间:2017-04-20 06:33:35

标签: php html

我是新来的,我还在研究php和bootstrap,现在我试图使用col-sm-3每个类别及其子菜单。我发布了代码,我遇到了麻烦,因为我对他的编码很新。有人可以让我把它的li转换成col-sm-3,这样我就可以有一个好的菜单吗?

this is my current menu

我希望我的菜单变得像这样

and this is what i want if someone help me :D

<ul class="main-navigation">
  	
    <?php foreach ($categories as $category_1) { ?>
		<li>
			<a href="<?php echo $category_1['href']; ?>"><?php echo $category_1['name']; ?></a>
  			 <?php if ($category_1['children']) { ?>
			   <?php $i = count($category_1['children']); ?>
					
					<div class="categorybg">
						 <div class="categoryinner">
        					
								<ul>
								<?php $i=1; ?>
								<?php foreach ($category_1['children'] as $category_2) { ?>
							
								<li class="categorycolumn"><b><a class="submenu1" href="<?php echo $category_2['href']; ?>"><?php echo $category_2['name']; ?></a></b>
								
								  <?php if($category_2['children']) { ?>
									<?php $j = count($category_2['children']); ?>
									<?php if($j<=10) { ?>
									
									<div class="cate_inner_bg">
									  <ul>
										 <?php foreach ($category_2['children'] as $category_3) { ?>
										 <li><a class="submenu2" href="<?php echo $category_3['href']; ?>"><?php echo $category_3['name']; ?></a></li>
										 <?php } ?>
									  </ul>
									</div>
								
									<?php } else { ?>
									
									<div>
									  <ul>
									  <?php $j=0; ?>
										 <?php foreach ($category_2['children'] as $category_3) { ?>
										 <li><a class="submenu2" href="<?php echo $category_3['href']; ?>"><?php echo $category_3['name']; ?></a></li>
										 <?php if (++$j == 10) ?>
										 <?php } ?>
										 <li><a class="submenu2" href="<?php echo $category_2['href']; ?>">More....</a></li>
									  </ul>
									</div>
									<?php } ?>
									
								</li>
								<?php } ?>
							
								<?php } ?>
								
								</ul>
								
					
		
							
						</div>
					</div>
				
				<?php } ?>
	  		<?php } ?>
	  	</li>
  </ul>

0 个答案:

没有答案