Basically, I wanted to generate a menu based on the user navigation or (Request URI), I spend the last hour trying to write this, it works as I wanted, but I need to clean it up, I am not a Guru, but this is how I managed to get to the solution:
function showNavigationPath()
{
//$request_uri = $_SERVER['REQUEST_URI'];
$request_uri = "About/Weather/Park/Addo/"; //Test URI
$current_url_length = strlen($request_uri);
$uri_split = str_split($request_uri);
$link_counter = 0;
$buffer = "";
for($i=0;$i<$current_url_length;$i++)
{
$buffer .= $uri_split[$i];
if($uri_split[$i] == "/") // Found a "/" in the URI String
{
$link[$link_counter] = $buffer;
$buffer = "";
$link_counter++;
}
}
//echo($buffer); // Test
$link_counter = 0;
$final_nav = "<a href='/'>Home</a> "; // Buffer like store for Final out of the Navigation
foreach($link as $item)
{
@$url .= $item;
//echo("url[" . $c . "] " . $url[$c] . "<br /> ");
$final_nav .= ">> <a href='" . $url ."'>$item</a> ";
$link_counter++;
}
print("Final Nav: " . $final_nav);
}