<?php require 'app.inc.php'; require 'appmenu.inc.php'; $app = new Application('Trilingual', $menu); // Get language from URI or cookie or (default) "de", set new cookie $lang = $_GET['lang']; if (!$lang) $lang = $_COOKIE['lang']; if (!$lang) $lang = 'de'; setcookie('lang', $lang); // Add styles that hide divs in inactive languages $app->head_add .= "<style type=\"text/css\"><!--\n"; foreach (array('de', 'en', 'fr') as $l) if ($l != $lang) $app->head_add .= "div[lang|=$l] { display: none; }\n"; $app->head_add .= "--></style>"; $app->header(); ?> <div lang="en"> <h2>Different languages</h2> <p>This is english text.</p> <p>Change language: <a href="?lang=de">german</a> | <a href="?lang=fr">french</a></p> </div> <div lang="de"> <h2>Verschiedene Sprachen</h2> <p>Das ist der deutsche Text.</p> <p>Sprache ändern: <a href="?lang=fr">französisch</a> | <a href="?lang=en">englisch</a></p> </div> <div lang="fr"> <h2>Des différentes langues</h2> <p>C'est le texte français.</p> <p>Changer de langue: <a href="?lang=en">anglais</a> | <a href="?lang=de">alleman</a></p> </div> <pre>Cookie: <?php print_r($_COOKIE); ?></pre> <?php $app->footer() ?>