Header Menu Panel (header-menu.php)
Overview
This panel renders the top navigation menus for the Logistics platform.
It builds both the main site navigation and a user-specific menu when a customer is logged in.
Main Navigation 🧭
This section uses Bootstrap’s navbar components to display core site sections.
<div class="main-navigation">
<nav class="navbar navbar-default">
<!-- Collapsible toggle for mobile -->
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse"
data-target="#teach-menu">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
- Wraps links in
<ul class="nav navbar-nav">. - Highlights the active link via PHP’s
basename($_SERVER['PHP_SELF']). - Adds dropdown toggles with Font Awesome carets.
Current Page Detection
The code determines the active menu item with:
<?php
$page_name = basename($_SERVER['PHP_SELF']);
?>
$page_nameholds the current PHP filename.- Conditional classes (
class="active"/class="active dropdown") apply to<li>.
Submenus & Dropdowns
The menu features several dropdowns. Each entry follows this pattern:
<li <?php if($page_name=='some_page.php'){ ?> class="active dropdown"<?php } ?>>
<a href="some_page.php">Title</a>
<i class="fa fa-caret-down"></i>
<ul class="dropdown-menu">
<!-- submenu links -->
</ul>
</li>
Freight Spend Management Dropdown
- Our Technology Advantage
- Pre Auditing and Carrier Payment Made Easy
- Monthly Savings Reports
- Easy Freight Claims
- International Freight Spend Savings
- The Tech Logistics Process
- Request Consultation
- The Tech Difference
Brokerage Services Dropdown
- Truckload Service
- LTL Service
- Expedited Brokerage Services
- Heavy Haul Services
- Inter-Modal Rail Service
- Air Freight Services
- Ocean Freight
- Request a Quote
Conditional “Quote & Ship” Link
This link appears only if the $_SESSION['rating_check'] == 'Y' flag is set:
<?php if(isset($_SESSION['rating_check']) && $_SESSION['rating_check']=='Y'){ ?>
<li <?php if(in_array($page_name, ['start_quote.php','start_quote2.php'])){ ?> class="active"<?php } ?>>
<a href="start_quote<?=($_SESSION['detail_product']=='Y')?'2':''?>.php">QUOTE & SHIP</a>
</li>
<?php } ?>
Contact Us Link
Always visible. Highlights when $page_name == 'contact_us.php'.
<li <?php if($page_name=='contact_us.php'){ ?> class="active"<?php } ?>>
<a href="contact_us.php">CONTACT US</a>
</li>
Static Sidebar Links
Below the main navbar, the code iterates over $staticPagesArray to render sidebar links:
<?php foreach($staticPagesArray as $pageArray){
if($pageArray["include_in_side_bar"] == 'Y'){ ?>
<a href="<?=$pageArray["page_key"]?>.php"
<?=($currnt_file_name==$pageArray["page_key"].".php")?' class="active_link"':''?>>
<?=$pageArray["page_name"]?>
</a>
<?php }} ?>
$staticPagesArraydefines title, key, and inclusion flag.- Uses
$currnt_file_namefor active-link styling.
User Navigation for Authenticated Users 👤
When $_SESSION['Customer_ID'] exists, the panel adds a “My Account” dropdown and other user actions:
<?php if(!empty($_SESSION['Customer_ID'])){ ?>
<div id="nav-user" class="ddsmoothmenu">
<ul>
<li>
<a href="my_account.php"<?=in_array($currnt_file_name,$myaccount_pages)?' class="active_link"':''?>>
My Account
</a>
<i class="fa fa-caret-down"></i>
<ul>
<!-- dynamic menu items -->
</ul>
</li>
<!-- logout link -->
</ul>
</div>
<?php } ?>
My Account Dropdown
It includes links based on various session flags:
| Session Flag | Value | Menu Item |
|---|---|---|
rating_check |
'Y' | Start a Quote |
create_shipment_check |
'Y' | Create Shipment |
create_bol && $isbol == "Y" |
'Y' | Create BOL |
small_package |
'Y' | Small Parcel |
my_shipments_check |
'Y' | My Shipments |
enable_claims |
'Y' | Claims |
dashboard |
'Y' | Dashboard (external) |
itools |
'Y' | ITools (external) |
product_catalog_check |
'Y' | Product Catalog |
address_book |
'Y' | Address Book |
shipment_coupon |
'Y' | Shipment Coupon |
import_international_pricing_v2 |
'Y' | International Quotes v3 |
international_quote && not import… |
'Y' | International Quotes (dev) |
Additional User Actions
- Logout button always appears when logged in.
- Small Parcel submenu with “View App” and “Report App” shows when
small_package == 'Y'.
Dependencies & Globals ⚙️
- Bootstrap:
.navbar,.collapse,.navbar-toggle. - Font Awesome:
<i class="fa fa-caret-down">. - jQuery: Collapsible behavior.
- PHP Globals:
$_SERVER['PHP_SELF'],$_SESSION,$staticPagesArray,$currnt_file_name. - Short PHP tags (
<?) requireshort_open_tag=Onor full<?php.
Rendering Flowchart
flowchart TD
A[Start header-menu.php] --> B{Session started?}
B -- No --> C[Render main navigation]
B -- Yes --> C
C --> D[Detect current page]
D --> E[Render top-level menu]
E --> F[Render sidebar links]
F --> G{Customer logged in?}
G -- Yes --> H[Render user navigation]
G -- No --> I[Skip user navigation]
H --> I
I --> Z[End rendering]
Integration & Customization 🔧
- Include this panel in your header template:
<?php include 'inc/panels/header-menu.php'; ?> - Customize menu items by editing the static
<ul>or session-driven conditions. - Extend
$staticPagesArrayin the parent script to add sidebar links. - Adjust Bootstrap classes for alternate themes or layouts.