Gerrit_van_Weele Posted September 2, 2015 Share Posted September 2, 2015 (edited) Hey,I was a php programmer, I'm a time been very ill because of that I've lost a lot of memory so I very much like things the programming process is difficult because I can almost completely got rid of that part.but I want to pick up again as I am now doing just a month I'll be there but not out, what was once a makie is now very difficult.but I want my good cms to put in a bootstrap admin I bought an admin template http://themeforest.net/item/pixit-admin-frontend-template/7528815 and I want to use.only I did not come out to make the sidebar menu with submenus with my php function, who wants to convert it into a working and thereby indicate what and how it works.this is my function: function build_sidebar_menu( $div_container = ' class="main-menu" ', $div_id = ' id="topnav" ', $ul_id ='class="sidebar-nav" ', $nest = 0, $use_expand = true, $expand = true ) { if ( empty ( $this->my_array )) return; $selected = ''; $arrow = ''; $active = ''; //$html = '<!-- vision_to_homepage (php class) dynamic menu - by www.visionto.nl -->' . "\n"; //$html .= '<div>' . "\n"; $html .= ' <div' . $div_container . '>' . "\n"; $html .= "\n" . '<ul ' . $ul_id . '>' . "\n"; foreach ( $this->my_array as $key => $node ) { // if($this->add_titles == true) // $html .= "\n".'<li><h3 class="headerbar" >'.$node[ 'name' ].'</h3></li>' . "\n"; if ( $node['active'] && $node['parent'] == 0 ) { if ( $this->menu_titles == true ) $html .= "\n" . '<li><h3 class="headerbar" >' . $node['title'] . '</h3></li>' . "\n"; $subsign = ( $this->get_children_1( $node['id'] ) != false ) ? $this->subsign : ''; if ( strlen( $node['css'] ) || strlen( $subsign )) $html .= '<li ' . $subsign; // $html .= '<li class="' . $node[ 'css' ] . '">'.$subsign; else $html .= '<li ' . $subsign; $querystring = $node['file_name']; if ( in_array( $node['id'], $this->active_path )) { $selected = 'class="current" '; //$expand = true; } if ( $node['id'] == $this->get_file_id_eregi( )) { $active = ' class="active" '; $arrow = $this->arrow; } $html .= $selected . '>'. '<a href="' . $querystring .'"><span class="sidebar-text">' . $node['title'] . '</span>' . $arrow . '</a>' ; $selected = ''; $arrow = ''; $active = ''; $html .= $this->get_children_1( $node['id'], $nest++ ); $html .= '</li>' . "\n"; } } $html .= "\n" . '</ul>' . "\n"; $html .= "\n" . '</div>'; return $html . "\n" . '</div>'; } //========================================================================================== function get_children_1( $id, $nest = 0, $ul_sub = '' ) { if ( empty ( $this->my_array )) return; $selected = ''; $arrow = ''; $active = ''; $has_children = false; $indent = ''; $tabify = $nest ? str_repeat( '\t', $nest ) . ' ' : ''; $html = ''; if ( $nest == 0 ) $html .= $ul_sub . "\n"; else $html .= "\n" . '<ul class="submenu collapse">' . "\n"; foreach ( $this->my_array as $key => $node ) { if ( $node['active'] && $node['parent'] == $id ) { $has_children = true; //found node $add_class = ( $this->get_children_1( $node['id'] ) != false ) ? 'active' : ''; if ( strlen( $node['css'] ) || strlen( $add_class )) $html .='<li class=' . $add_class; // $html .= '<li class="' . $node[ 'css' ] . $add_class.'">'; else $html .= '<li>'; // $querystring = $node['file_name']; if ( in_array( $node['id'], $this->active_path )) { $selected = ' class="selected" '; } if ( $node['id'] == $this->get_file_id_eregi( )) { $active = ' class="active" '; $arrow = $this->arrow; } // $html .= '<a '.$selected.' href="' .$querystring.'" title="'.$node[ 'title' ].'" >'.$node[ 'title' ].'</a>'.$this->check_file_status($node[ 'file_name' ]).$arrow; $html .= '<a ' . $selected . ' href="' . $querystring . '"><span class="sidebar-text">' . $node['title'] . '</span>' . $arrow . '</a>'; $selected = ''; $arrow = ''; $html .= $this->get_children_1( $node['id'], $nest++ ); $active = ''; $html .= '</li>' . "\n"; } } $html .= "\n" . '</ul>' . "\n"; return ( $has_children ) ? $html : false; } if I use this function and I look at the HTML than it looks almost the same but I do not get out at all subs an arrow and when I click on the link then the dropdown does not work ...there is a js function to but I understand nothing of him charging him but nothing happens? /* Toggle submenu open */ function toggleSidebarMenu() { var $this = $('.sidebar-nav'); $this.find('li.active').has('ul').children('ul').addClass('collapse in'); $this.find('li').not('.active').has('ul').children('ul').addClass('collapse'); $this.find('li').has('ul').children('a').on('click', function (e) { e.preventDefault(); $(this).parent('li').toggleClass('active').children('ul').collapse('toggle'); $(this).parent('li').siblings().removeClass('active').children('ul.in').collapse('hide'); }); } can anyone help me, I'm not coming out there Thanks. Edited September 2, 2015 by Gerrit_van_Weele Quote Link to comment https://forums.phpfreaks.com/topic/298028-php-function-for-bootstrap-sidebarmenu/ Share on other sites More sharing options...
Gerrit_van_Weele Posted September 2, 2015 Author Share Posted September 2, 2015 html result is : <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js sidebar-large lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js sidebar-large lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js sidebar-large lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js sidebar-large"><!--<![endif]--> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title> - Vision.to Design</title> <!-- Begin Mandatory style --> <link href="assets/css/icons/icons.min.css" rel="stylesheet" /> <link href="assets/css/bootstrap.min.css" rel="stylesheet" /> <link href="assets/css/plugins.css" rel="stylesheet" /> <link href="assets/css/style.min.css" rel="stylesheet" /> <link href="#" rel="stylesheet" id="theme-color" /> <!-- End Mandatory style --> <!-- Begin Page Level Style --> <link href="assets/plugins/fullcalendar/fullcalendar.css" rel="stylesheet" /> <link href="assets/plugins/metrojs/metrojs.css" rel="stylesheet" /> <!-- End Page Level Style --> <script src="assets/plugins/modernizr/modernizr-2.6.2-respond-1.1.0.min.js" type="text/javascript"></script> </head> <body data-page="dashboard"> <!-- Begin Admin Header --> <!-- Begin Top Menu --> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#sidebar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a id="menu-medium" class="sidebar-toggle tooltips"> <i class="fa fa-outdent"></i> </a> <a href="index.html" class="navbar-brand"> </a> </div> <div class="navbar-center">Dashboard</div> <div class="navbar-collapse collapse"> <!-- Begin Top Navigation Menu --> <ul class="nav navbar-nav pull-right header-menu"> <!-- End Admin Header --> <!-- Begin User Dropdown --> <!-- Begin Top Navigation Menu --> <ul class="nav navbar-nav pull-right header-menu"> <!-- Begin User Dropdown --> <li id="user-header" class="dropdown"> <a href="#" class="dropdown-toggle c-white" data-close-others="true" data-hover="dropdown" data-toggle="dropdown"> <img class="p-r-5" alt="user avatar" src="assets/img/avatars/avatar2.png" width="30" /> <span class="username">Gerrit</span> <i class="fa fa-angle-down p-r-10"> </i> </a> <ul class="dropdown-menu"> <li> <a href="./my_account.php"><i class="glyph-icon flaticon-account"></i>My Profile </a> <li class="dropdown-footer clearfix"><a href="javascript:;" title="Fullscreen" class="toggle_fullscreen"> <i class="glyph-icon flaticon-fullscreen3"> </i> </a> <a href="lockscreen.html" title="Lock Screen"> <i class="glyph-icon flaticon-padlock23"></i> </a> <a href="http://localhost/CMS_Ultimatev16/admin/adm_cms.php?Logout=True" title="Logout"> <i class="fa fa-power-off"></i> </a> </li> </ul> </li> <!-- End User Dropdown --> <!-- End Top Navigation Menu --> </div> </div> </nav> <!-- Begin Wrapper --> <div id="wrapper"> <!-- Begin Main Sidebar --> <nav id="sidebar"> <div class="main-menu" > <ul class="sidebar-nav" > <li ><a href="../admin/index.php"><span class="sidebar-text"> Admin Panel</span></a></li> <li ><a href="../admin/adm_content.php"><span class="sidebar-text"> Admin Content</span></a> <ul class="submenu collapse"> <li><a href="../admin/adm_content_tags.php"><span class="sidebar-text">Admin Content Tags</span></a></li> <li><a href="../admin/adm_content_blocks.php"><span class="sidebar-text">Content Blocks</span></a></li> <li><a href="../admin/tags_index.php"><span class="sidebar-text">Tags Index</span></a></li> <li><a href="../admin/adm_slider.php"><span class="sidebar-text">Slider</span></a></li> <li><a href="../admin/adm_ajax_js.php"><span class="sidebar-text">Ajax JS</span></a></li> <li><a href="./admin/adm_sponsers.php"><span class="sidebar-text">Sponsers</span></a></li> </ul> </li> <li ><a href="../admin/adm_users.php"><span class="sidebar-text"> Admin UserList</span></a> <ul class="submenu collapse"> <li><a href="../admin/adm_login_log.php"><span class="sidebar-text"> Admin Login Log</span></a></li> <li><a href="../admin/adm_groups.php"><span class="sidebar-text"> Admin Groups</span></a></li> <li><a href="../admin/adm_roles.php"><span class="sidebar-text"> Admin Roles</span></a></li> </ul> </li> <li class="current" ><a href="../admin/adm_cms.php"><span class="sidebar-text"> Admin CMS</span><span class="fa arrow"></span></a> <ul class="submenu collapse"> <li><a href="../admin/adm_navigation.php"><span class="sidebar-text"> Admin Navigation</span></a></li> <li><a href="../admin/adm_ui_countries.php"><span class="sidebar-text"> Admin Countries</span></a></li> <li><a href="../admin/adm_languages.php"><span class="sidebar-text"> Admin Languages</span></a></li> <li><a href="../admin/adm_styles.php"><span class="sidebar-text"> Admin Styles</span></a></li> <li><a href="../admin/adm_report_messages.php"><span class="sidebar-text"> Admin Report Messages</span></a></li> <li><a href="../admin/adm_responders.php"><span class="sidebar-text"> Admin Email Responders</span></a></li> <li><a href="../admin/license.php"><span class="sidebar-text">License</span></a></li> <li><a href="../admin/adm_sections.php"><span class="sidebar-text"> Admin Sections</span></a></li> <li><a href="../admin/sys_info.php"><span class="sidebar-text">SYS Info</span></a></li> <li><a href="../admin/adm_cms_settings.php"><span class="sidebar-text">CMS Settings</span></a></li> </ul> </li> <li ><a href="index.php"><span class="sidebar-text">Home</span></a></li> <li ><a href="../admin/adm_sitemap.php"><span class="sidebar-text"> Admin Sitemap</span></a></li> </ul> </div> </div> </div> </nav> <!-- End Main sideBar --> <!-- Begin Main Content --> <div id="main-content"> <div class="row"> <div class="col-lg-12"> <h1>Blank Page <small>Blank Page</small></h1> <br><br><br> </div> </div> </div> <!-- End Wrapper --> </div> </ul> </nav> <script src="assets/js/application.js" type="text/javascript"></script> <script src="assets/plugins/jquery-1.11.js" type="text/javascript"></script> <script src="assets/plugins/jquery-migrate-1.2.1.js" type="text/javascript"></script> <script src="assets/plugins/jquery-ui/jquery-ui-1.10.4.min.js" type="text/javascript"></script> <script src="assets/plugins/jquery-mobile/jquery.mobile-1.4.2.js" type="text/javascript"></script> <script src="assets/plugins/bootstrap/bootstrap.min.js" type="text/javascript"></script> <script src="assets/plugins/bootstrap-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script> <script src="assets/plugins/bootstrap-select/bootstrap-select.js" type="text/javascript"></script> <script src="assets/plugins/mcustom-scrollbar/jquery.mCustomScrollbar.concat.min.js" type="text/javascript"></script> <script src="assets/plugins/mmenu/js/jquery.mmenu.min.all.js" type="text/javascript"></script> <script src="assets/plugins/nprogress/nprogress.js" type="text/javascript"></script> <script src="assets/plugins/charts-sparkline/sparkline.min.js" type="text/javascript"></script> <script src="assets/plugins/breakpoints/breakpoints.js" type="text/javascript"></script> <script src="assets/plugins/numerator/jquery-numerator.js" type="text/javascript"></script> <script src="assets/plugins/jquery.cookie.min.js" type="text/javascript"></script> <script src="assets/plugins/bootstrap-switch/bootstrap-switch.js" type="text/javascript"></script> <script src="assets/plugins/bootstrap-progressbar/bootstrap-progressbar.js" type="text/javascript"></script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/298028-php-function-for-bootstrap-sidebarmenu/#findComment-1520147 Share on other sites More sharing options...
Gerrit_van_Weele Posted September 2, 2015 Author Share Posted September 2, 2015 hi, its collaps, only this what not works is, if there are subs its not show a arrow ??? Quote Link to comment https://forums.phpfreaks.com/topic/298028-php-function-for-bootstrap-sidebarmenu/#findComment-1520150 Share on other sites More sharing options...
Ch0cu3r Posted September 2, 2015 Share Posted September 2, 2015 If you are having technical issues or need help using the template then I suggest you contact the author of template you bought it from. Quote Link to comment https://forums.phpfreaks.com/topic/298028-php-function-for-bootstrap-sidebarmenu/#findComment-1520157 Share on other sites More sharing options...
Gerrit_van_Weele Posted September 3, 2015 Author Share Posted September 3, 2015 hi, the template is working good but its only html, I have a php funtion ( you can sie ) and in the function if I hef on line 95, 96 submenu ther come no arrow on line 95 ?? Quote Link to comment https://forums.phpfreaks.com/topic/298028-php-function-for-bootstrap-sidebarmenu/#findComment-1520180 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.