Code:
<?php
$MenuItem = Array (
'/Citadel/' => None,
'/Citadel/FAQ' => QA,
'/Citadel/SSM' => QA,
'/Citadel/Concordance' => Theme,
'/Citadel/Encyclopaedia' => Theme,
'/Citadel/Heraldry' => Theme,
'/Citadel/History' => Theme,
'/Citadel/Characters' => Story,
'/Citadel/Prophecies' => Story,
'/Citadel/Artwork' => Miscellany,
'/Citadel/Books' => Miscellany,
'/Citadel/Images' => Miscellany,
'/Citadel/Links' => Miscellany
);
$SubMenu = Array (
'/Citadel/' => None,
'/Citadel/FAQ' => QA,
'/Citadel/SSM' => QA,
'/Citadel/Concordance' => Theme,
'/Citadel/Encyclopaedia' => Theme,
'/Citadel/Heraldry' => Theme,
'/Citadel/History' => Theme,
'/Citadel/Characters' => Story,
'/Citadel/Prophecies' => Story,
'/Citadel/Artwork' => Miscellany,
'/Citadel/Books' => Miscellany,
'/Citadel/Images' => Miscellany,
'/Citadel/Links' => Miscellany
);
$SubMenuItem = Array (
'/Citadel/' => None,
'/Citadel/FAQ' => FAQ,
'/Citadel/SSM' => SSM,
'/Citadel/Concordance' => Concordance,
'/Citadel/Encyclopaedia' => Encyclopaedia,
'/Citadel/Heraldry' => Heraldry,
'/Citadel/History' => History,
'/Citadel/Characters' => Characters,
'/Citadel/Prophecies' => Prophecies,
'/Citadel/Artwork' => Artwork,
'/Citadel/Books' => Books,
'/Citadel/Images' => Images,
'/Citadel/Links' => Links
);
$URL = $_SERVER['PHP_SELF'];
$Folders = substr($URL,0,strrpos($URL,"/"));
$WhichMenuItem = $MenuItem[$Folders];
$WhichSubMenu = $SubMenu[$Folders];
$WhichSubMenuItem = $SubMenuItem[$Folders];
?>
I am not absolutely certain that the above works as intended (for example, sets $WhichMenuItem to 'QA' for pages in the /Citadel/FAQ folder), as I have had a lot of help with pieceing it together. The idea is that it is supposed to go on each page to determine in which folder that page resides. Will it work to just use a php include to put this code (its in a separate file) anywhere on each page? Or is there anywhere that php includes can't go, like before </head>?
Bookmarks