ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /proc/self/root/var/www/html/tien-dien/layout/visahp/ |
<?php // Ensure $DB, $CORE, $INFO, $arr_option are available in this scope, // typically included from a core file or initialized earlier. /** * Displays a hierarchical list of menu categories. * * @param array $all_categories The complete list of category items. * @param int $parent_id The ID of the parent category for the current level. * @param int $level The current depth of the menu (0 for root). */ function showCategories($all_categories, $parent_id = 0, $level = 0) { global $CORE, $INFO; // $INFO is expected to contain 'home_url' $menu_fname_active = ''; if (isset($CORE->input['menu_ftitle']) && $CORE->input['menu_ftitle'] != '') { $menu_fname_active = $CORE->input['menu_ftitle']; } $children_of_current_parent = []; foreach ($all_categories as $category_item) { if (isset($category_item['menus_parentid']) && $category_item['menus_parentid'] == $parent_id) { $children_of_current_parent[] = $category_item; } } // If there are no children for this parent, stop rendering this branch. if (empty($children_of_current_parent)) { return; } // Determine the class for the <ul> element. // Root <ul> (level 0) typically doesn't need a class if styled by <nav id="mobile-menu"> parent. // Sub-menus (level > 0) get the 'sub-menu' class. $ul_class_attribute = ''; if ($level > 0) { $ul_class_attribute = ' class="sub-menu"'; } else { // You can add a class for the root <ul> here if your theme requires it, // e.g., $ul_class_attribute = ' class="main-navigation-list"'; } echo "<ul{$ul_class_attribute}>"; foreach ($children_of_current_parent as $item) { // Check if the current $item has any children in the $all_categories list $item_has_children = false; if (isset($item['menus_id'])) { foreach ($all_categories as $potential_child_item) { if (isset($potential_child_item['menus_parentid']) && $potential_child_item['menus_parentid'] == $item['menus_id']) { $item_has_children = true; break; } } } // Prepare CSS classes for the <li> element $li_classes = []; if (!empty($menu_fname_active) && isset($item['menus_fname']) && $menu_fname_active == $item['menus_fname']) { $li_classes[] = 'current-menu-item'; } if ($item_has_children) { $li_classes[] = 'menu-item-has-children'; // Essential for dropdown styling } // Optional: Add level-specific class to LI for more granular styling // $li_classes[] = 'menu-item-level-' . $level; $li_class_attribute = !empty($li_classes) ? ' class="' . implode(' ', $li_classes) . '"' : ''; // Determine the link's URL $link_href = '#'; // Default fallback if (!empty($item['menus_url'])) { // Prioritize explicit URL if provided $link_href = $item['menus_url']; } elseif (isset($item['menus_fname'])) { // Construct URL from menus_fname, relative to home_url $base_url = ''; if (isset($INFO['home_url'])) { $base_url = rtrim($INFO['home_url'], '/'); } if ($item['menus_fname'] == 'trang-chu') { $link_href = $base_url . '/'; } else { if (!empty($item['menus_fname'])) { $link_href = $base_url . '/' . trim($item['menus_fname'], '/') . '/'; } } } // Clean up potential double slashes like example.com//path to example.com/path // but preserve http:// or https:// if (strpos($link_href, '://') === false) { // It's a relative path or just a slug part $link_href = preg_replace('~/{2,}~', '/', $link_href); } else { // It's an absolute URL $link_href = preg_replace('~(?<!:)/{2,}~', '/', $link_href); } echo "<li{$li_class_attribute}>"; echo '<a href="' . htmlspecialchars($link_href) . '">' . htmlspecialchars($item['menus_name'] ?? 'Unnamed Menu') . '</a>'; // If this item has children, recursively call showCategories to render them as a sub-menu if ($item_has_children) { // --- MEGA MENU HOOK POINT --- // If you want to implement a mega menu for specific items (e.g., 'Sản phẩm'), // you would add conditional logic here. // Example: // if ($level == 0 && isset($item['menus_fname']) && $item['menus_fname'] == 'san-pham') { // echo '<div class="mega-menu-dropdown">'; // Wrapper for the mega menu panel // // Call a custom function to render mega menu content, possibly in columns // // renderMegaMenuContent($all_categories, $item['menus_id']); // // Or, if the mega menu still uses ul/li but needs a specific class on the ul: // // showCategories($all_categories, $item['menus_id'], $level + 1, true /* is_mega_child_ul */); // echo '</div>'; // } else { // // Standard recursive call for sub-menus showCategories($all_categories, $item['menus_id'], $level + 1); // } // For now, we'll use the standard recursive call for all children. // showCategories($all_categories, $item['menus_id'], $level + 1); } echo '</li>'; } echo '</ul>'; } // Fetch categories from the database // This part should remain similar to your existing code. $categories_data = array(); $query_categories_data = $DB->query("SELECT * FROM tb_menus ORDER BY `menus_pos` ASC"); while ($row_categories_data = $DB->fetch_row($query_categories_data)) { $categories_data[] = $row_categories_data; } ?> <body> <!--[if lte IE 9]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p> <![endif]--> <!-- Add your site or application content here --> <!-- preloader --> <div id="preloader"> <div class="preloader"> <span></span> <span></span> </div> </div> <!-- preloader end --> <!-- back to top start --> <div class="progress-wrap"> <svg class="progress-circle svg-content" width="100%" height="100%" viewBox="-1 -1 102 102"> <path d="M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98"></path> </svg> </div> <!-- back to top end --> <!-- header area start here --> <header> <div class="header-top"> <div class="container"> <div class="row align-items-center"> <div class="col-xxl-8 col-lg-6"> <div class="header-top-left"> <ul> <li><marquee> <?php echo $arr_option['blogname'];?> <?php echo $arr_option['website_address'];?> </marquee> </li> </ul> </div> </div> <div class="col-xxl-4 col-lg-6"> <div class="topheader-info"> <!--<div class="top-button f-right "> <a href="/lien-he/">Apply Now</a> </div>--> <!--<div class="header-language f-right"> <select> <option data-display="English">English</option> <option value="1">Bangla</option> <option value="2">Arbi</option> <option value="3">China</option> <option value="4">Turky</option> </select> </div>--> <div class="header-location f-right"> <ul> <li><i class="fal fa-phone-alt"></i> <a href="tel:<?php echo $arr_option['phone_homepage']??'';?>"><?php echo $arr_option['phone_homepage']??'';?></a></li> </ul> </div> </div> </div> </div> </div> </div> <div class="header-menu header-sticky"> <div class="container"> <div class="row align-items-center"> <div class="col-xxl-2 col-xl-2 col-lg-2 col-8"> <div class="header-logo "> <a href="<?php echo $INFO['home_url'];?>"><img src="upload/logos/<?php echo $arr_option['logo_website'];?>" alt="<?php echo $arr_option['blogname'];?>" class="img-fluid"></a> </div> </div> <div class="col-xxl-7 col-xl-7 col-lg-7 col-4"> <div class="main-menu d-none d-lg-block "> <nav id="mobile-menu"> <?php showCategories($categories_data); ?> <!--<ul> <li class="menu-item-has-children"><a href="index.html">HOME</a> <ul class="sub-menu"> <li><a href="index.html">Home Style 1</a></li> <li><a href="index-2.html">Home Style 2</a></li> </ul> </li> <li class="menu-item-has-children"><a href="coaching.html">Coaching</a> <ul class="sub-menu"> <li><a href="coaching.html">Coaching</a></li> <li><a href="ielts-course.html">Coaching Details</a></li> </ul> </li> <li class="menu-item-has-children"><a href="services.html">Services</a> <ul class="sub-menu"> <li><a href="services.html">Services</a></li> <li><a href="business-visa.html">Services Details</a></li> </ul> </li> <li class="menu-item-has-children"><a href="#">PAGES</a> <ul class="sub-menu"> <li><a href="about.html">About</a></li> <li><a href="team.html">Team</a></li> <li><a href="team-details.html">Team Details</a></li> <li><a href="countries.html">Countries</a></li> <li><a href="united-states.html">Country Details</a></li> <li><a href="partners.html">Partners</a></li> <li><a href="faq.html">Faq</a></li> <li><a href="404-error.html">404 Error</a></li> </ul> </li> <li class="menu-item-has-children"><a href="news.html">News</a> <ul class="sub-menu"> <li><a href="news.html">News</a></li> <li><a href="news-details.html">News Details</a></li> </ul> </li> <li><a href="contact.html">CONTACT</a></li> </ul>--> </nav> </div> <div class="side-menu-icon d-lg-none text-end"> <button class="side-toggle"><i class="far fa-bars"></i></button> </div> </div> <div class="col-xxl-3 col-xl-3 col-lg-3"> <div class="main-menu-wrapper d-flex align-items-center justify-content-end"> <div class="main-menu-wrapper__search text-left"> <a class="search-btn nav-search search-trigger" href="#"><i class="fal fa-search"></i></a> </div> <div class="main-menu-wrapper__call-number d-flex align-items-center"> <div class="main-menu-wrapper__call-text"> <ul class="social_links-2"> <li> <a class="" href="https://www.facebook.com/visahoangphuc?ref=embed_page" target="_blank"> <i class="fab fa-facebook-f"></i> </a> </li> <li> <a class="" href="#"> <i class="fab fa-twitter"></i> </a> </li> <li> <a class="" href="#"> <i class="fab fa-instagram"></i> </a> </li> <li> <a class="" href="#"> <i class="fab fa-pinterest-p"></i> </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="offcanvas-overlay"></div> <div class="fix"> <div class="side-info"> <button class="side-info-close"><i class="fal fa-times"></i></button> <div class="side-info-content"> <div class="mobile-menu"></div> </div> </div> </div> </header> <!-- Fullscreen search --> <div class="search-wrap"> <div class="search-inner"> <i class="fal fa-times search-close" id="search-close"></i> <div class="search-cell"> <form method="get" action="?"> <input type="hidden" name="act" value="search"> <div class="search-field-holder"> <input type="search" name="q" class="main-search-input" placeholder="Nháºp từ khóa"> </div> </form> </div> </div> </div> <!-- end fullscreen search --> <!-- header area end here --> <main>