Search the Community
Showing results for tags 'function bootstrap'.
-
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.