function dispayListCate($categories, $level = 0, $link = 'categories/') { if (!is_array($categories) or empty($categories)) { return ''; } $html = ''; if (count($categories)) { $cate_id = array(); foreach ($categories as $category) { if ($link . $category->id . '-' . $category->slug == uri_string()) { $icon = '<span class="glyphicon glyphicon-minus" onclick="module_show_list_cate(this);"></span>'; $style = 'style="display: block"'; $active = 'class="active"'; } else { $icon = '<span class="glyphicon glyphicon-plus" onclick="module_show_list_cate(this);"></span>'; $style = 'style="display: none"'; $active = ''; } if ($level == 0) { if (count($category->subcategories) > 0) { $html .= '<li ' . $active . '>' . $icon . '<a href="' . site_url() . $link . $category->id . '-' . $category->slug . '">' . $category->title . '</a>'; } else { $html .= '<li ' . $active . '><a href="' . site_url() . $link . $category->id . '-' . $category->slug . '">' . $category->title . '</a>'; } if (count($category->subcategories) > 0) { $html .= '<ul ' . $style . ' class="nav nav-list">'; $html .= dispayListCate($category->subcategories, $level, $link); $html .= '</ul>'; } $html .= '</li>'; } else { if ($category->id == $level || $category->parent_id == $level || in_array($category->parent_id, $cate_id)) { $cate_id[] = $category->id; if (count($category->subcategories) > 0) { $html .= '<li>' . $icon . '<a href="' . site_url() . $link . $category->id . '-' . $category->slug . '">' . $category->title . '</a>'; } else { $html .= '<li><a href="' . site_url() . $link . $category->id . '-' . $category->slug . '">' . $category->title . '</a>'; } if (count($category->subcategories) > 0) { $html .= '<ul ' . $style . '>'; $html .= dispayListCate($category->subcategories, $level, $link); $html .= '</ul>'; } $html .= '</li>'; } else { $html .= dispayListCate($category->subcategories, $level, $link); } } } } return $html; }
echo '<h4>' . $category->title . '</h4>'; } if (isset($content->show_level) && $content->show_level != '') { $show_level = $content->show_level; } else { $show_level = ''; } echo '<div class="module-categories">'; if (isset($content->show_number) && $content->show_number != '') { $show_number = $content->show_number; } else { $show_number = 8; } if (isset($content->layout) && $content->layout == 'list') { echo '<ul class="nav nav-list list-categories">'; $categories = dispayListCate($categories, $cate_id); $categories = explode('<li>', $categories); $i = 0; foreach ($categories as $category) { if ($show_number < $i) { break; } if ($category != '') { echo '<li>' . $category . '</li>'; } $i++; } } else { echo '<ul class="thumb-categories">'; $categories = dispayThumbCate($categories, $cate_id, $show_level); $categories = explode('<li>', $categories);
echo '<h4>' . $category->title . '</h4>'; } if (isset($content->show_level) && $content->show_level != '') { $show_level = $content->show_level; } else { $show_level = ''; } echo '<div class="module-categories">'; if (isset($content->show_number) && $content->show_number != '') { $show_number = $content->show_number; } else { $show_number = 8; } if (isset($content->layout) && $content->layout == 'list') { echo '<ul class="nav nav-list list-categories">'; $categories = dispayListCate($categories, $cate_id, 'idea/'); $categories = explode('<li>', $categories); $i = 0; foreach ($categories as $category) { if ($show_number < $i) { break; } if ($category != '') { echo '<li>' . $category . '</li>'; } $i++; } } else { echo '<ul class="thumb-categories">'; $categories = dispayThumbCate($categories, $cate_id, $show_level, 'idea/'); $categories = explode('<li>', $categories);