28 lines
1.2 KiB
PHP
28 lines
1.2 KiB
PHP
<?php
|
|
global $current_file, $menu_items, $active_profession, $active_profession_title;
|
|
$current_file = basename($_SERVER['SCRIPT_NAME']); // Extracts File Name ONLY, Not File Path
|
|
|
|
/* Navigation Bar Pages, 'fileName' => ['Page Name', 'pageIcon'] */
|
|
$menu_items = [
|
|
'index.php' => ['Home', 'logo.png'],
|
|
'alchemyIngredientPage.php' => ['Alchemy', 'alchemy.png'],
|
|
'blacksmithing.php' => ['Blacksmithing', 'blacksmithing.png'],
|
|
'engineering.php' => ['Engineering', 'engineering.png'],
|
|
'jewelcrafting.php' => ['Jewelcrafting', 'jewelcrafting.png'],
|
|
'leatherworking.php' => ['Leatherworking', 'leatherworking.png'],
|
|
'tailoring.php' => ['Tailoring', 'tailoring.png'],
|
|
];
|
|
|
|
$active_profession = ''; // File Name, e.g., 'alchemyIngredientPage' or 'blacksmithing'
|
|
$active_profession_title = ''; // Page Name, e.g., 'Alchemy' or 'Blacksmithing'
|
|
|
|
/* Finds & Sets Active Profession Page */
|
|
foreach ($menu_items as $file => $info) {
|
|
$root_file_name = pathinfo($file, PATHINFO_FILENAME); // Extracts File Name ONLY, Not File Path
|
|
|
|
if (str_starts_with($current_file, $root_file_name)) {
|
|
$active_profession = $root_file_name;
|
|
$active_profession_title = $info[0];
|
|
break;
|
|
}
|
|
} |