Multi language - seo links
Posted on
16th Feb 2014 07:03 pm by
admin
Im trying to figure out the best method to have a multi language website that will function with seo friendly links.
The code that ive used many times before.....
Code: $_SESSION['lang'] = $lang = (isset($_GET['lang']) ?
mysql_real_escape_string(trim($_GET['lang'])) : (isset($_SESSION['lang']) ? $_SESSION['lang'] : 'en')); if (!function_exists("GetSQLValueString"))
which i like as it refreshes the page that the viewer is on and pulls down info form the db with the correct extension i.e. about_en, about_it, about_de etc etc
The problem is when the user changes the language using with the follwing...
Code: if ($_SERVER['QUERY_STRING'])
{
echo "<a href="?{$_SERVER['QUERY_STRING']}&lang=en">EN</a>";
}
else
{
echo "<a href="?lang=en">EN</a>";
}
?></li>
<li><?php if ($_SERVER['QUERY_STRING'])
{
echo "<a href="?{$_SERVER['QUERY_STRING']}&lang=it">IT</a>";
}
else
{
echo "<a href="?lang=it">IT</a>";
}
?></li>
<li><?php if ($_SERVER['QUERY_STRING'])
{
echo "<a href="?{$_SERVER['QUERY_STRING']}&lang=fr">FR</a>";
}
else
{
echo "<a href="?lang=fr">FR</a>";
the page refreshes but with '?lang=it' at the end of the address, therefore im 'presuming' the mod_rewrite will fail...
any ideas of what would be the best solution..
many thanks
No comments posted yet
Your Answer:
Login to answer
182 54
Other forums
Problem displaying "scraped" XML data
I'm basicly having trouble displaying XML data scraped from an URL using cURL.
What the code
Text to picture Generator
Hello, i have found this script and it works really good^^ But i have one problem, i would like to c
Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.
Image DPI
Hi.
I allow users to upload images, the user then is able to adjust several settings for the
formating when pulling data from a mysql database
Ok so Im not to sure if this is the right thread to post in but here is my catch 22 issue.
I
Procedure with variable number of columns
Hi, I have a procedure that looks like this:
PROCEDURE PROC(p_cursor OUT sys_refcurso
finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");
$rc = 1;
while(!feof($openedfile))
{<
Limiting checkboxes?
Hi guys,
I have this code: Code: if(isset($_POST['selected'])) {
foreach($_POST['selec
DataTable Help Required
Hi all I am creating an app that utilises and MS Access back end and queries it quite a bit at vario
natcasesort works on one server but not on another
Hi
I have a problem that I was hoping that someone can help me with.
I'm trying to use