function article($id, $name) { $data = DB::table('tb_article')->where('category_id', $id)->where('status', '=', 1)->count(); $article = ''; if ($data > 0) { $article = "<li><a href='" . Url() . "/category/" . Convert_string::tosmall($name) . "'>" . $name . " <span class='badge'>{$data}</span></a></li>"; } return $article; }
} echo "<li class='{$active}'><a href='" . Url() . "'>Home</a></li>"; $head_cat = DB::table('tb_category')->orderBy('name', 'asc')->where('prnt', '=', 0)->get(); foreach ($head_cat as $row) { //echo "<li><a href='".Url()."/category/".Convert_string::tosmall($row->name)."'>".$row->name."</a></li>"; $active = ''; if ($url == strtolower($row->name) || $ur2 == $row->id) { $active = 'active'; } $head_cat_sub = DB::table('tb_category')->orderBy('name', 'asc')->where('prnt', '=', $row->id)->get(); if (count($head_cat_sub) > 0) { $link = array(); $id = array(); foreach ($head_cat_sub as $item) { $link[] = strtolower($item->name); $id[] = $item->id; } $active = ''; if (in_array($url, $link) || in_array($ur2, $id)) { $active = 'active'; } echo "\n\t\t\t\t\t\t\t<li class='dropdown {$active}'>\n\t\t\t\t\t\t\t\t<a href='" . Url() . "/category/" . Convert_string::tosmall($row->name) . "' class='dropdown-toggle' data-toggle='dropdown'>" . $row->name . " <i class='fa fa-angle-down'></i></a>\n\t\t\t\t\t\t\t\t<ul class='dropdown-menu'>"; foreach ($head_cat_sub as $item) { echo "<li><a href='" . Url() . "/category/" . Convert_string::tosmall($item->name) . "'>" . $item->name . "</a></li>"; } echo "</ul>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t"; } else { echo "<li class='{$active}'><a href='" . Url() . "/category/" . Convert_string::tosmall($row->name) . "'>" . $row->name . "</a></li>"; } } echo "\n\t\t\t\t\n\t\t\t\t<!--<li class='dropdown'>\n\t\t\t\t\t<a href='#' class='dropdown-toggle' data-toggle='dropdown'>Categories <i class='fa fa-angle-down'></i></a>\n\t\t\t\t\t<ul class='dropdown-menu'>\n\t\t\t\t\t\t<li><a href='" . Url() . "'>Blog Single</a></li>\n\t\t\t\t\t\t<li><a href='pricing.html'>Pricing</a></li>\n\t\t\t\t\t\t<li><a href='404.html'>404</a></li>\n\t\t\t\t\t\t<li><a href='shortcodes.html'>Shortcodes</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</li>\n\t\t\t\t<li><a href='about-us.html'>Profile</a></li>\n\t\t\t\t<li><a href='services.html'>Skills</a></li>\n\t\t\t\t<li><a href='portfolio.html'>Portfolio</a></li>\n\t\t\t\t<li><a href='contact-us.html'>Contact</a></li>\n\t\t\t\t-->\n\t\t\t</ul>\n\t\t</div>\n\t</div><!--/.container-->\n</nav><!--/nav-->";