Files
ahand/TargetScanner/sidebar.php
T

33 lines
1.5 KiB
PHP

<?php global $current_file, $active_profession_title; ?>
<?php
// Skip rendering the sidebar if we are on the homepage
if (!empty($active_profession) && $active_profession !== 'index'):
// 2. Define the static utilities/tools every profession uses
$sidebar_tools = [
'ingredients' => ['Supplies Needed', 'profession_supplies.php'],
'market' => ['Current Market Prices', 'profession_market.php'],
'leveling' => ['Leveling Guide', 'profession_leveling.php'],
];
?>
<aside class="sidebar" aria-label="<?= htmlspecialchars($active_profession_title) ?> Tools">
<h3 class="sidebar__title"><?= htmlspecialchars($active_profession_title) ?> Utilities</h3>
<ul class="sidebar__list">
<?php foreach ($sidebar_tools as $key => $tool_info): ?>
<?php
// Generate link like: profession_supplies.php?prof=blacksmithing
$target_url = $tool_info[1] . '?prof=' . urlencode($active_profession);
// Check if this specific tool page is the one currently loaded
$is_tool_active = ($current_file === $tool_info[1]) ? ' sidebar__link--active' : '';
?>
<li class="sidebar__item">
<a href="<?= htmlspecialchars($target_url) ?>" class="sidebar__link<?= $is_tool_active ?>">
<?= htmlspecialchars($tool_info[0]) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</aside>
<?php endif; ?>