MVC方法中的下拉菜单

时间:2016-05-27 06:13:36

标签: php html model-view-controller drop-down-menu

我一直在努力了解这个现有的PHP代码,它显示下拉菜单及其后续菜单。虽然代码工作在一个级别,我很难如何或添加另一个级别的下拉菜单...我已经能够做到这一点,但在这种情况下,使用PHP来显示这些字段,它是亲切的对我来说令人难以置信......这是视图方面的现有代码 - >

 <ul class="nav navbar-nav">
                    <?php
                        foreach ($nav as $item) {
                            if (empty($item['children'])) {
                            ?>
                                    <li<?php if (!empty($item['is_active'])) { ?> class="active"<?php } ?>>
                                    <a href="<?php echo $item['link']; ?>"><?php if ($item['icon'] != '') { ?>
                                    <i class="<?php echo $item['icon']; ?>" data-toggle="tooltip" data-placement="bottom" data-original-title="A large tooltip."></i>&nbsp; <?php } echo $item['label']; ?></a></li>
                            <?php
                            } 
                            else 
                            {
                            ?>
                                <li class="dropdown <?php if (!empty($item['is_active'])) { ?> active<?php } ?>">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">
                                        <?php if ($item['icon'] != '') { ?>
                                            <i class="<?php echo $item['icon']; ?>"></i>
                                        &nbsp;<?php  echo $item['label']; ?>
                                        <b class="caret"></b><?php } ?>
                                    </a>

                                    <ul class="dropdown-menu"> 
                                <?php
                                            _main_menu_widget_display_children($item['children']);
                                ?>
                                    </ul>
                                </li>
                            <?php                   
                            }
                    }               
                ?>              

控制器看起来像这样 - &gt;

 $nav['settings']       = array('label' => 'Settings', 'icon' => 'fa fa-wrench fa-lg',   );
$nav['settings/access_rights']  = array('label' => 'Approver',  'icon' => 'fa fa-wrench fa-lg', 
                                'location' => site_url('admin/access_rights'), 'parent_id' => 'settings');          
            //separator
            $nav['settings/separator_1']    = array('blank' => true, 'parent_id' => 'settings');

            $nav['settings/billing_param']  = array('label' => 'Technician',    'icon' => 'fa fa-wrench fa-lg', 
                                'location' => site_url('billing_param'), 'parent_id' => 'settings');
            //separator
            $nav['settings/separator_2']    = array('blank' => true, 'parent_id' => 'settings');

            $nav['settings/support_settings']   = array('label' => 'Support',   'icon' => 'fa fa-wrench fa-lg', 
                                'location' => site_url('support_settings'), 'parent_id' => 'settings');
            //sub-menu sub of Support
            $nav['example1']    = array('label' => 'Request Supportt',  'icon' => 'fa fa-wrench fa-lg', 
                                'location' => '#', 'parent_id' => 'settings/support_settings');
            $nav['example2']    = array('label' => 'Need Features',     'icon' => 'fa fa-wrench fa-lg', 
                                'location' => '#', 'parent_id' => 'settings/support_settings');
            $nav['example3']    = array('label' => 'Telephone Number',  'icon' => 'fa fa-wrench fa-lg', 
                                'location' => '#', 'parent_id' => 'settings/support_settings');
            $nav['example4']    = array('label' => 'Testimonials',  'icon' => 'fa fa-wrench fa-lg', 
                                'location' => '#', 'parent_id' => 'settings/support_settings');
            $nav['example6']    = array('label' => 'Known Issues',  'icon' => 'fa fa-wrench fa-lg', 
                                'location' => '#', 'parent_id' => 'settings/support_settings');
            $nav['example5']    = array('label' => 'Road Map',  'icon' => 'fa fa-wrench fa-lg', 
                                'location' => '#', 'parent_id' => 'settings/support_settings');

这就是它的样子:enter image description here

我只是想在点击“设置”菜单时显示“支持”下的那些列表,而是在我悬停或点击后(实际上并不重要)“支持”子菜单...  我知道在'视图'方面缺少一些东西,但我不知道是什么...另一个如果 - 其他可能但我看不到任何联系到目前为止...任何帮助非常感谢,谢谢...:)

0 个答案:

没有答案