Flatlogic Bot f59042f511 Version 2
2025-10-26 13:25:51 +00:00

32 lines
1.4 KiB
PHP

<?php
// A simple helper to determine the active page
$current_page = basename($_SERVER['PHP_SELF']);
$nav_items = [
['id' => 'home', 'file' => 'index.php', 'icon' => 'home', 'label' => 'Home'],
['id' => 'ads', 'file' => '#', 'icon' => 'gem', 'label' => 'Ads'],
['id' => 'tasks', 'file' => 'tasks.php', 'icon' => 'check-square', 'label' => 'Tasks'],
['id' => 'withdrawal', 'file' => '#', 'icon' => 'landmark', 'label' => 'Withdrawal'],
['id' => 'profile', 'file' => '#', 'icon' => 'user', 'label' => 'Profile'],
];
?>
<nav class="nav-bottom">
<?php foreach ($nav_items as $item): ?>
<?php
// Determine if the current item is active.
// It's active if the current page matches the item's file name.
// For index.php, we also check if the page variable is 'home'.
$is_active = ($current_page == $item['file']);
if ($item['file'] == 'index.php' && isset($page) && $page == 'home') {
$is_active = true;
} elseif ($item['file'] == 'tasks.php' && isset($page) && $page == 'tasks') {
$is_active = true;
}
?>
<a href="<?php echo $item['file']; ?>" class="nav-item <?php echo $is_active ? 'active' : ''; ?>" id="nav-<?php echo $item['id']; ?>">
<i data-lucide="<?php echo $item['icon']; ?>"></i>
<span><?php echo $item['label']; ?></span>
</a>
<?php endforeach; ?>
</nav>