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
Reduce redundancies in switch functions?
Hello all! I somewhat new to PHP, and was wondering if anyone could give some suggestions on a switch function to reduce redundancies, and to efficaciously implement the script on to other
help countdown timers
hello every one,I'd like to know how to insert many countdowns in the same page.The duration of each must be different and defined by members with a form.
Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:QuoteBlah blahBlah blahetcbut when i echo it out, there is no formatting left it comes out as:QuoteBlah blah Blah blah etcis there an easy way to stop this?
delete comma
HI,How to delete "," at the end of the string.Code: $match = 2009/02/03/a2correx03cvbnm,echo preg_replace("/;$/", "HI", "$match");
I got my hosting suspended XD
So I saw this challenge a day or so agohttp://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110101&format=htmlAnd I thought to myself "Well, what about numbers
Warning: mysql_num_rows() supplied argument is not a valid MySQL result resource
This may be simple I just may need another pair of eyes..When i get records back the below code works just fine, when I get 0 rows back it shows the warning below. As you can see I tried to code for
How to Create a Dynamic table
col1 col2 date1 date2 date3 date4..........a b v1 v2 v3 v4c d v5 v6 v7 v8e f v9 v10 v11 v12 . .
php code generators
AllWhilst enjoying learning a new language i have come accross a number of free code generators out there to assist and save a lot of timecan anyone recommend what are the best free code generators
Need help making a blockquote and line items conditional
I have some code I bought a few years ago that allows my clients to update content on their site using an Excel spreadsheet. Well this particular application sometimes has line items so I need to come
Help: calling function
Hi,Is it possible to call a php function on page close?If yes, could you explain how and where to call?any example code will be appreciated.Thanks