Good night, awake! Help out pliz :) I deduce a recursion tree:

$ul = "<ul>\n"; foreach( $tree as &$item ){ if ( $item['parent'] == 0 ) { $ul .= "<li>\n <p class = sidebar-content-title>".$item['title']."<span class='pull-right icon awe-chevron-down'></span></p> \n </li> \n"; } else { $ul .= "<li> \n <a class = sidebar-link href='".$item['title_en']."'>".$item['title']."</a> \n </li> \n"; } if( ! empty($item['subitems']) ) $ul .= showTree( $item['subitems'] ); } $ul .= "</ul>"; return $ul; 

Categories (class = sidebar-content-title>) are displayed as follows, and for sub-categories (class = sidebar-link), the class it assigns it to% disappears during the output, and "\ n" does not tolerate lines ... what a crap so

  • Put quotes for the class ('). Not all browsers are able to parse on a human, what you display. A \ n should work. Do you have double quotes in the code or just here? - SilverIce
  • They stood (quotes), removed thought could help ... already the head was spinning from them. And the lines are of course double ... what code is that and laid out. By the way, I drew them again - it did not help. I look in firefox and chrome. - Dimych
  • But in general, that the thread is changing? can you not correct that file? - zb '
  • No, I work with him. To complete the picture, a piece of the output code: <ul> <li> <p class = 'sidebar-content-title'> Section 1 <span class = 'pull-right icon awe-chevron-down'> </ span> </ p> </ li> <ul> <li> <a href="subCategory1.1"> under section 1.1 </a> </ li> <li> <a href="subCategory1.2"> under section 1.2 < / a> </ li> <li> <a href="subCategory1.3"> under section 1.3 </a> </ li> <li> <a href="subCategory1.4"> under section 1.4 </ a > </ li> </ ul> <li> <p class = 'sidebar-content-title'> Section 2 <span class = 'pull-right icon awe-chevron-down'> </ span> </ p> </ li> - Dimych
  • one
    According to your code, why do you have an internal UL outside LI? It should be: <ul> <li> Text <ul> <li> </ li> </ ul> </ li> </ ul> - SilverIce

0