Como são os links do idoma?
ou são enviados como??idioma=ingle
?idioma=portugues
Se for assim, você poderia pegar esse valor em:
$idioma=$_GET['idioma'];no script de tradutor.php .

Posted 28/06/2008, 12:41
ou são enviados como??idioma=ingle
?idioma=portugues
$idioma=$_GET['idioma'];no script de tradutor.php .
Posted 28/06/2008, 14:29
Posted 28/06/2008, 14:50
$idioma = $_GET['idioma'];
$padrao= "portugues";
if (strlen($idioma)>0){
$id = $idioma;
$_SESSION['IDIOMA'] = $id;
}
elseif (isset($_SESSION['IDIOMA'])){
$id = $_SESSION['IDIOMA'];
}elseif (detectaLiguagem()){
$id = detectaLiguagem();
$_SESSION['IDIOMA'] = $id;
}else{
$id = $idioma;
$_SESSION['IDIOMA'] = $id;
}
Edição feita por: lwirkk, 28/06/2008, 15:05.
Posted 28/06/2008, 16:50
<?php session_start(); $strFullLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'] ,0,2); function detectaLiguagem(){ global $strFullLang; $sigla = $strFullLang; if ($sigla[0] = "pt"){ return "portugues"; }elseif ($sigla[0] = "en"){ return "ingles"; }else{ return false; } } $idioma = $_GET['idioma']; $padrao= "portugues"; if (strlen($idioma)>0){ $id = $idioma; $_SESSION['IDIOMA'] = $id; } elseif (isset($_SESSION['IDIOMA'])){ $id = $_SESSION['IDIOMA']; }elseif (detectaLiguagem()){ $id = detectaLiguagem(); $_SESSION['IDIOMA'] = $id; }else{ $id = $idioma; $_SESSION['IDIOMA'] = $id; } function tradutor($cod){ global $id; $nome = $id.".txt"; if (!file_exists($nome)){ $nome = $idioma.".txt"; } $fp = fopen($nome, "r"); for($i = 0; $i < $cod; $i++){ $buffer = fgets($fp, 4096); } return $buffer; fclose($fp); } ?>
<? include ("tradutor.php"); ?> <html> <head> <title><?= Tradutor(12) ?></title> </head> <body bgcolor="#ffffff" text="#000000" link="#3661a1" vlink="#6f6c81" alink="#d5aa83"> <br><center><font color="#3661a1" size="+6"><?= $_SESSION["IDIOMA"] ?>W W W . C O M . B R</font></center><br><h4><center> ( <b><?= Tradutor(1) ?></b> ) ( <a href=index.php><?= Tradutor(2) ?></a> . <a href="index.php"><?= Tradutor(3) ?></a> . <a href="index.php"><?= Tradutor(4) ?></a> . <a href="index.php"><?= Tradutor(5) ?></a> ) ( <a href="mailto:foob@r.com"><?= Tradutor(6) ?></a> ) </center></h4> <br><table width=570 border=0 cellspacing=0 cellpadding=0 align=center><tr> <td align=center bgcolor=#adccff> <b><font color=white><?=Tradutor(8)?></font></b> </td></tr><tr> <td align=left> <br> <div align=left> <b><?=Tradutor(7)?></b> </div> <!-- Start of news --> <small> <br> <br>21/09/07 - <?=Tradutor(13)?> </small> <!-- End of news --> <br><br> </td></tr></table> <table width=570 border=0 cellspacing=0 cellpadding=0 align=center> <tr> <td align=center bgcolor=#adccff> <small>[<a href="mailto:sdg2k@mail.com">@</a>]</small> </td> </tr></table><br> <br><br><center><?=Tradutor(11)?>:<br> <a href="index.php?idioma=ingles"><?=Tradutor(9)?></a> | <a href="index.php?idioma=portugues"><?=Tradutor(10)?></a></center> </body> </html>
Posted 02/07/2008, 15:17
$idioma = $_GET['idioma'];
Posted 02/07/2008, 16:14
$idioma = $_GET['idioma'];
Posted 02/07/2008, 16:31
error_reporting(E_ALL ^ E_NOTICE);
Posted 02/07/2008, 16:50
Posted 20/10/2017, 18:10
Posted 20/10/2017, 21:29
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)