Manual of PHP

 
 
 

Web map

 
rim   rim
arrowReady frontarrow of Codes PHParrow to Show Content in accordance with the country in php

 

To show Content in accordance with the country in php To print E-mail
The following script for PHP sends the code of the country and of the language when the navigator requests it.

Often, and especially the international webmaster, we have met the need to show a content in accordance with the country and the languages.

In this Workshop of PHP we are going to see a simple code that will allow to know the country of the user and show a different page for every case.

<? php

//it changes pagina.php for the correct file in accordance with the country

if (isset ($pais) && ($pais <> ")) {
$dgo_pais = substr ($pais, 0,5);
} else {
$dgo_pais = substr ($_SERVER ["HTTP_ACCEPT_LANGUAGE"], 0,5);
}
switch ($dgo_pais) {

marry "es-mx":
//if the country is mexico
include ("pagina.php");
break;

marry "es-ar":
//if the country is Argentine
include ("pagina.php");
break;

marry "es-cl":
//if the country is a chili
include ("pagina.php");
break;

marry "es - it sees":
//if the country is venezuela
include ("pagina.php");
break;

marry "pt-br":
//if the country is brasil
include ("pagina.php");
break;

marry "es-co":

//if the country is colombia
include ("pagina.php");
break;

marry "es-ec":

//if the country is an equator
include ("pagina.php");
break;

marry "es-uy":

//if the country is uruguay
include ("pagina.php");
break;

default:
//if it is some another country
include ("pagina.php");
break;
}
?>


He remembers that to change pagina.php for the page of every country, for example, paginates - mexico.php. It is possible to use this script like principal page, so that it is different according to the country.

Aaron Gomez Perez.
http://www.elwey.com/

 

 
Front
Chapters of the Manual of PHP
Introduction to PHP
Variables
My First Script PHP
Operators in PHP
Structures of Control
Functions in PHP
Code inclusion
Counterfoils (array)
Chains of Characters
Classes
Dates
Entry and Exit
Operations with Files
The language SQL and PHP
Connection with MySQL
Meetings
Forms with PHP
To practise in line
List of practices in line
FAQ
Frequent questions
Codes PHP
List of Codes PHP
Forums
Forums PHP
Other Manuals
Manuals of other languages
 
   
 
 
MySpaceScripts.info - Sitemap - Contact us - Sitemap - Contact us - Sitemap - Contact us

Dior Replica Handbag , Holzhaus , bílé víno , p2m , used cars , posizionamento Google , Panasonic