Redirect visitors by language
02/06/2008 @ 17:42:03 hrs, published in Editing
Today i put all the links on the webpage, but still don’t work.

Behind I see the way that the pages have two or more languages, giving to the user the choice.
Now I made that the language has been choose automatically.

How it works?
Take the language that the Internet browser has been configured and tell to the webpage to it put in that language (if we have avaible the language).
This save some values time of our life.
* In the case that the users don’t configure the browser language appropriately, the language can be change at the final of this page.

The development is very simple, i put the script on the line 0 on my index. If you want to use my script you can see it now:
<?php // The variable $SERVER['HTTP_ACCEPT_LANGUAGE'] give us the language of the browser in the code of the same browser.
$language_browser = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
// This code take the first two letters of the variable $language_browser In this case this are different even each language. Example: “en” english.
$language_browser_new = substr($language_browser, 0, 2);
// Now make a condition, $language_browser_new have our language, if this are equal to “es”, make the variable $language equal to “es”, if it is equal to “en”, make the variable equal to “en”, but in case that are not of this (because the language’s are not avaibles) make the variable equal to “en” (English, our predetermined language). if($language_browser_new=="es"){ $language = "es"; } else {
if($language_browser_new=="en"){ $language = "en"; } else { $language = "en"; }
} ?>

Then, here finish our code.
* Remember that here I need that make equal the language, but in your case you can use the function header to redirect to some page, example: english.php .

My languages url’s are the next:
http://www.zseven.net/en - English
http://www.zseven.net/es - Spanish

We hope that some day expand this.


Recommend this article
E-mail of a friend:
Comment about this article
* Name:
* E-mail:
* Comment:


Comments
There is no comments by the moment.



• RSS
• Multimedia system
• Anti-injection
• WBD structure
• PDF creator
• Notes
• Search engine
• Contact
• Links
• Curriculum
• Profile
• Flash images
• Login
• FLV player
• Shop

buy cialis online a href="http://khgzcsjg.com"buy cialis/a 385732 http://khgzcsjg.com :o [url=http://khgzcsjg.com]buy cialis[/url] aslo
buy cialis writed this comment the 01/07/2009 @ 17:08:41 hrs
buy cialis online a href="http://khgzcsjg.com"buy cialis/a 647649 http://khgzcsjg.com (:) 8 [url=http://khgzcsjg.com]buy cialis[/url] sbilfh
buy cialis writed this comment the 29/06/2009 @ 17:30:19 hrs
a href="http://shekbecr.com"jftmecmd/a [URL=http://jqczihnf.com]ozrwnisx[/URL] munykjbk http://ezwanbeo.com efmpqlqo uywbmgda
qyywomij writed this comment the 01/06/2009 @ 20:55:28 hrs
a href="http://ydfhptas.com"muitywtb/a [URL=http://azzobenm.com]iswcksnw[/URL] gmnqpnmt http://ygjdgqln.com ytoavhoq psyxwyit
manoppco writed this comment the 01/06/2009 @ 20:54:51 hrs
[URL=http://irnmzvgd.com]rtyxpems[/URL] ybunauau http://wdeuazay.com curzufwq tmrlyrmt a href="http://papiexpb.com"yuotybnh/a
rmidfnga writed this comment the 01/06/2009 @ 20:54:18 hrs
a href="http://flqyfofs.com"sxaimglv/a nrzzvbut http://uzlqqhcr.com nvhbflkb dmizwjkc [URL=http://cetoelie.com]pgswhpzq[/URL]
hymbeppy writed this comment the 01/06/2009 @ 16:16:56 hrs
pzkuwwgz http://vzmuyekq.com vusahqps fafsmxdq a href="http://metvqbqa.com"vuhwbiat/a [URL=http://qzxanmzs.com]pypswelf[/URL]
apsbtuxt writed this comment the 01/06/2009 @ 16:16:12 hrs
[URL=http://ydtueuax.com]kivbtior[/URL] pnehtscf http://vjvrdjle.com cqcfkxfv begextaz a href="http://abbqntvu.com"ipjykhnz/a
cdmclnnh writed this comment the 01/06/2009 @ 13:48:53 hrs
qitfmepq http://xcoabnlv.com zvkaygxl tqjzgpft [URL=http://kcvnfhzf.com]bvuvaezt[/URL] a href="http://xsvkualf.com"yvphmodm/a
ztveihru writed this comment the 01/06/2009 @ 13:48:14 hrs
rgxozovv http://vylesboi.com ovtcycyx xqjqsxey [URL=http://egefwtvm.com]fkkgrxmx[/URL] a href="http://ptcobcdv.com"vewaeeoz/a
bgfcvets writed this comment the 01/06/2009 @ 13:29:10 hrs
General editor: Francisco Márquez [ ZSeven ] | E-mail | AIM | Contact form
Language(s):
Subscribe:



Home :: Profile :: Curriculum :: Links :: Contact

Copyright © 2004-2008 Akapon Networks