I devised a simple way of generating a menu from an external file. I then have my script strip non alpha-numeric characters to generate the name of the page, which reflects it's menu name.
However, I would also like to display the header of the page based on the querystring. The problem is that the querystring reflects the name of the file, and not it's actual menu name.
Is there a way to associate the querystring value with it's original value in the array?
For example, here is the code to generate the links:
$array=file("menu.txt");
foreach ($array as $line) {
$linker = ereg_replace("[[:alnum:]]", "", $line);
echo "<a href=\"".$PHP_SELF."?page=".$linker."\">".$line."</a></td>";
}
If my menu array contains a line that says "The Intro", it will generate the querystring value "theintro"
So what I'd like is a function that somehow looks up which position "theintro" was in the array so it can display "The Intro" on the page.
The whole point of this is to keep my array as minimalistic as possible, instead of having it like this:
theintro :: The Intro
thenextpage :: The Next Page
ect..
Can this be done?