I'm looking for the solution to this problem:
I want to be able to check on which page (or parent) i am by looking at the current url via php.
My urls look like this:
http://www.adomain.com/parent/stuff-behind-parent
or
http://www.adomain.com/parent/stuff-...-parents-child
and of course the homepage which is
http://www.adomain.com/
Now I want to parse the url and being left with only the parent name so I can use this in a switch. The parent is the only thing I need to know since this is the main menu...
$current_url should be parsed to just the name... or something like that
I'm now so far:
PHP Code:
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
$current_url = $port.$_SERVER['REQUEST_URI'];
switch ($current_url) {
case '/':
echo "Home";
break;
case '/parent1':
echo "Parent1";
break;
case '/parent2':
echo "Parent2";
break;
}
Hopefully somebody can help.