Allora, sto facendo così:
index.php
Codice PHP:
<?php
include "config.php";
$page = $_GET['page'];
$language = $_GET['language'];
?????
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><? echo $trad['titleHome']; ?></title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="SHORTCUT ICON" href="./Images/favicon.ico" />
<link rel="stylesheet" href="style.css" type="text/css" />
<meta name="KEYWORDS" content="tv-player, ubuntu, linux, gnu, tv, radio, vlc" />
</head>
<body>
<div id="testata"><? echo $trad['headHome']; ?></div>
<div id="sinistro"><? include "./Frames/menu.php"; ?></div>
<div id="destro"><? include "./Frames/menu2.php"; ?></div>
<div id="centrale">
<? include "./Pages/$page.php"; ?>
</div>
<div id="fondo"><? include "./Frames/fondo.php"; ?></div>
</body>
</html>
config.php
Codice PHP:
<?php
$defaultlang = "en";
$langpath = "./lang/";
session_start();
if (isset($_SESSION['lingua'])) {
if(isset($_GET['lang'])) {
$_GET['lang'] = str_replace("/","", trim(strtolower($_GET['lang'])));
if (is_file($langpath."/".$_GET['lang'].".php")) {
$_SESSION['lingua'] = $_GET['lang'];
} else {
$_SESSION['lingua'] = $defaultlang;
}
}
} else {
$_SESSION['lingua'] = $defaultlang;
}
include($langpath."/".$_SESSION['lingua'].".php");
?>
menu.php
Codice PHP:
<center>MENÙ</center>
menu2.php
Codice PHP:
<center>
<form>
<select name="language" post="index.php">
<option value="en">English</option>
<option value="it">Italian</option>
</select>
</form>
Domanda: come faccio a fare girare la variabile con <form><select> che con <a href=""> sarebbe girata così:
Codice HTML:
<a href="<? echo $PHP_SELF ?>?lang=it">Italiano</a> | <a href="<? echo $PHP_SELF ?>?lang=en">English</a>