Answer the question
In order to leave comments, you need to log in
How to make netcat and bootstrap menu friends?
Good afternoon, colleagues!
I'm trying to transfer a site written using bootstrap to CMS Netcat, everything seems to be clear, but I ran into a problem. Namely - in the multi-level menu.
The actual menu code is below:
$subs_arr = array(96);
$headerMenu[0]['prefix'] = "\"; global \$subs_arr, \$headerMenu; \$result.=\"<ul class='navbar-nav'>";
$headerMenu[0]['suffix'] = "</ul>";
$headerMenu[0]['active'] = "<li class='nav-item dropdown'><a \".(in_array(\$data[\$i][Subdivision_ID],\$subs_arr) ? \"class='nav-link dropdown-toggle' id='navbarDropdown' role='button' aria-haspopup='true' aria-expanded='false' data-toggle='dropdown'\":\"class='nav-link'\").\" href='%URL'>%NAME\".s_browse_sub(\$data[\$i][Subdivision_ID],\$headerMenu[1]).\"</a></li>";
$headerMenu[0]['active_link'] = "<li class='nav-item active dropdown'><a \".(in_array(\$data[\$i][Subdivision_ID],\$subs_arr) ? \"class='nav-link dropdown-toggle active' id='navbarDropdown' role='button' aria-haspopup='true' aria-expanded='false' data-toggle='dropdown'\":\"class='nav-link active'\").\" href='%URL'>%NAME\".s_browse_sub(\$data[\$i][Subdivision_ID],\$headerMenu[1]).\"</a></li>";
$headerMenu[0]['unactive'] = "<li class='nav-item dropdown'><a \".(in_array(\$data[\$i][Subdivision_ID],\$subs_arr) ? \"class='nav-link dropdown-toggle' id='navbarDropdown' role='button' aria-haspopup='true' aria-expanded='false' data-toggle='dropdown'\":\"class='nav-link'\").\" href='%URL'>%NAME\".s_browse_sub(\$data[\$i][Subdivision_ID],\$headerMenu[1]).\"</a></li>";
$headerMenu[0]['sortby'] = "Priority ASC";
$headerMenu[1]['prefix'] = "\"; \$headerMenu; \$result.=\"<ul class='dropdown-menu' aria-labelledby='navbarDropdown'>";
$headerMenu[1]['suffix'] = "</ul>";
$headerMenu[1]['active'] = $headerMenu[1]['active_link'] = $headerMenu[1]['unactive'] = "<a class='dropdown-item' href='%URL'>%NAME</a>";
$headerMenu[1]['sortby'] = "Priority ASC";
Answer the question
In order to leave comments, you need to log in
Not relevant already, of course, but I'll leave it for those who will look for the same:
The problem is in the closing tag. It should have been before calling the second level menu.
Thanks for the code, I actually changed it so that the parent category in the query is calculated:
$headerMenu[0]['prefix'] = "\"; global \$headerMenu; \$result.=\"<ul class='navbar-nav'>";
$headerMenu[0]['suffix'] = "</ul>";
$headerMenu[0]['unactive'] = "<li class='nav-item dropdown'><a \".(\$db->get_var(\"Select Parent_Sub_ID FROM Subdivision WHERE Parent_Sub_ID=\".\$data[\$i][Subdivision_ID])!=0 ? \"class='nav-link dropdown-toggle' id='navbardrop' data-toggle='dropdown'\" : \"class='nav-link'\").\"href='%URL'>%NAME</a>\".s_browse_sub(\$data[\$i][Subdivision_ID],\$headerMenu[1]).\"</li>";
$headerMenu[0]['sortby'] = "Priority ASC";
$headerMenu[1]['prefix'] = "\"; \$headerMenu; \$result.=\"<ul class='dropdown-menu' aria-labelledby='navbarDropdown'>";
$headerMenu[1]['suffix'] = "</ul>";
$headerMenu[1]['active'] = $headerMenu[1]['active_link'] = $headerMenu[1]['unactive'] = "<a class='dropdown-item' href='%URL'>%NAME</a>";
$headerMenu[1]['sortby'] = "Priority ASC";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question