Thanks for the thorough reply! That was more than I expected.
All of the pages are translated and there won't be a whole lot of maintenance so I decided to have two directories: en/ and fr/ each with the same structure just with the translated copy so I'm not concerned about scope or maintenance challenges.
I suppose I could hard code the URLs to switch from, say en/about/index.asp to fr/about/index.asp but I'd rather use a dynamic solution in the URL in the event that the site does become a little less simplified in the future.
I stumbled across this which I named language-switch.php and saved to my root dir:
Code:
<?php
$completeNewURL = "";
$referer = "$HTTP_REFERER ";
$brokenDownReferer = "";
if (stristr($referer, "/en/")){
$brokenDownReferer = str_replace("/en/", "/fr/", $referer);
}else{
$brokenDownReferer = str_replace("/fr/", "/en/", $referer);
}
//These two lines of code will redirect the user to the corresponding
//french/english version of the page they were just on.
//print("$completeNewURL");
$URL="$brokenDownReferer";
header ("Location: $brokenDownReferer");
?>
and then in my en/about/index.php file I hyperlinked this:
Code:
<a href="../includes/language-switch.php">Francais</a>
After confirming that the path to the language-switch.php file was correct the script didn't work. Unfortunately, I'm running this test on localhost so I can't post an example.
Cheers
Bookmarks