Last active
November 29, 2017 18:22
-
-
Save evilnapsis/94b9ad89bb50b9f77045f96dd11c29ce to your computer and use it in GitHub Desktop.
Ejemplo de pagina multi-idioma facil con php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Powered by http://evilnapsis.com/ --> | |
<?php | |
$lang = "es"; | |
if(isset($_GET["lang"]) && $_GET["lang"]!=""){ | |
if($_GET["lang"]=="en" || $_GET["lang"]=="es"){ | |
$lang = $_GET["lang"]; | |
} | |
} | |
$frases = array( | |
"es"=>array( | |
"frase1"=>"Bienvenido!", | |
"frase2"=>"Este micro sitio web es multi-idioma", | |
"frase3"=>"Servicios", | |
"frase4"=>"Los mejores servicios para ti" | |
), | |
"en"=>array( | |
"frase1"=>"Welcome!", | |
"frase2"=>"This micro website is multi-language", | |
"frase3"=>"Services", | |
"frase4"=>"The best services for you" | |
) | |
); | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<p><a href="paginax.php?lang=es">Espa~ol</a> <a href="paginax.php?lang=en">Ingles</a></p> | |
<h1><?php echo $frases[$lang]["frase1"]; ?></h1> | |
<p class="lead"><?php echo $frases[$lang]["frase2"]; ?></p> | |
<h2><?php echo $frases[$lang]["frase3"]; ?></h2> | |
<p ><?php echo $frases[$lang]["frase4"]; ?></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment