如何在opencart 2.1.0.2中添加菜单字段

时间:2017-04-07 05:28:18

标签: php opencart

在Localhost中如何关于我们,联系美国和家庭添加字段。 我试试

<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">     
<?php foreach ($categories as $category) { ?>
<?php if ($category['children']) { ?>      
<li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?></a>
<div class="dropdown-menu">
<div class="dropdown-inner">
<?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
<ul class="list-unstyled">
<?php foreach ($children as $child) { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>

1 个答案:

答案 0 :(得分:0)

请参阅下面的代码,我已经为主菜单添加了list标签。希望它可以帮到你。

<div class="collapse navbar-collapse navbar-ex1-collapse">
    <ul class="nav navbar-nav">
        <li><a href="<?php ?>index.php?route=common/home">Home</a></li>
        <?php foreach ($categories as $category) { ?>
            <?php if ($category['children']) { ?>
                <li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?></a>
                <div class="dropdown-menu">
                    <div class="dropdown-inner">
                        <?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
                            <ul class="list-unstyled">
                                <?php foreach ($children as $child) { ?>
                                    <li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
                                <?php } ?>
                            </ul>
                        <?php } ?>
                    </div>