// index.php:
<?php
include('common.inc.php');
XHTMLHeader()
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title; ?></title>
</head>
<body>
// common.inc.php:
<?php
session_start();
//All languages that are available
$lang = array ('en', 'de');
//Determines the Browser language and compares it to the available langauges, if the language isn't available choose english
if (!isset($_SESSION['userlang']))
{
$language = getenv('HTTP_ACCEPT_LANGUAGE');
if ($language != '')
{
$language = substr($language, 0, 2);
} else {
$language = 'en';
}
$langcode = 0;
for ($i = 1; $i <= sizeof($lang); $i++)
{
if ($lang[$i] == $language)
{
$langcode = $i;
last;
}
}
$_SESSION['user_lang'] = $langcode;
}
//Include the chosen localication
include($lang[$_SESSION['user_lang']].'/translation.inc.php');
//Header for all XHTML files
function XHTMLHeader()
{
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>'."\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'."\n";
echo ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
}
?>
// translation.inc.pp:
<?php
$title = 'Creative Commons Media on your iPhone';
?>