Usando variables

Volver.

Seleccione idioma para esta página

Castellano

Inglés

ninguno


Este archivo


<?php
session_start
();
if (
$_GET['language']) $_SESSION['language'] = $_GET['language'];
if (
file_exists($_SESSION['language'] . '.php')) include $_SESSION['language'] . '.php';
?>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo $tx_title?></title>
</head><body>
<h1><?php echo $tx_mediante_define ?></h1>
<p align="right"><a href="../"><?php echo $tx_volver '.'?></a></p>
<p><?php echo $tx_seleccione_idioma ?></p>
<form method="get" action="index.php">
<p><input type="radio" name="language" value="es" <?php if ($_SESSION['language'] =='es') echo 'checked' ?> /> <?php echo $tx_castellano ?></p>
<p><input type="radio" name="language" value="en" <?php if ($_SESSION['language'] =='en') echo 'checked' ?>/> <?php echo $tx_ingles ?></p>
<p><input type="radio" name="language" value="xx" <?php if ($_SESSION['language'] =='xx') echo 'checked' ?>/> <?php echo $tx_no_hay ?></p>
<input type="submit" name="submit" value="<?php echo $tx_aceptar ?>" />
</form>
<?php
mostrar_archivos
();
function 
mostrar_archivos() {
         global 
$tx_este_archivo$tx_archivo_de_traducciones$tx_no_hay;
         
?>
         <hr />
         <h3><?php echo $tx_este_archivo ?></h3>
         <pre><?php highlight_file('index.php'); ?></pre>
         <hr />
         <h3><?php echo $tx_archivo_de_traducciones ?></h3>
         <pre><?php if (file_exists($_SESSION['language'] . '.php')) highlight_file($_SESSION['language'] . '.php'); else echo $tx_no_hay?></pre>
         <?php
}
?>
</body></html>


Archivo de traducciones


<?php
$tx_title 
'Usando variables';
$tx_mediante_define 'Usando variables';
$tx_seleccione_idioma 'Seleccione idioma para esta página';
$tx_castellano 'Castellano';
$tx_ingles 'Inglés';
$tx_no_hay 'ninguno';
$tx_aceptar 'Aceptar';
$tx_este_archivo 'Este archivo';
$tx_archivo_de_traducciones 'Archivo de traducciones';
$tx_volver 'Volver';
?>