© Alsacreafans.com - 2015 | Cet exemple de page HTML n'est pas de la responsabilité d'Alsacreations.com et n'a été mis en place que pour des raisons didactiques. Jojaba.            
            
                Source de la page
                <?php
$lang = $fr_class = $en_class = '';
/* Récupération de la langue dans la chaîne get */
$lang = (isset($_GET['lang']) && file_exists('lang/'.$_GET['lang'].'.json')) ? $_GET['lang'] : 'fr';
/* Définition de la class pour les liens de langue */
if ($lang == 'fr')
    $fr_class = ' class="active"';
else
    $en_class = ' class="active"';
/* Récupération du contenu du fichier .json */
$contenu_fichier_json = file_get_contents('lang/'.$lang.'.json');
/* Les données sont récupérées sous forme de tableau (true) */
$tr = json_decode($contenu_fichier_json, true);
?>
<!DOCTYPE html>
<html lang="<?php echo $lang ?>">
    <head>
        <meta charset="utf-8">
        <title><?php echo $tr['head_title'] ?></title>
        <meta name="description" content="<?php echo $tr['head_description'] ?>">
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <header>
            <h1><?php echo $tr['site_h1'] ?></h1>
            <p><?php echo $tr['site_description'] ?></p>
        </header>
        <nav><a<?php echo $en_class ?> href="?lang=en">en</a> <a<?php echo $fr_class ?> href="?lang=fr">fr</a></nav>
        <main>
            <article>
                <header>
                    <h2><?php echo $tr['page_h2'] ?></h2>
                </header>
                <?php echo $tr['page_content'] ?>
            </article>
        </main>
        <footer>
            <p>
                <?php echo $tr['footer_text'] ?>
            </p>
        </footer>
    </body>
</html>
              
                fr.json
                {
    "head_title":"Le site officiel des Alsacreafans",
    "head_description":"La Communauté des fans d'Alsacreations.com",
    "site_h1":"Alsacreafans",
    "site_description":"Nous pensons qu'Alsacreations.com est une initiative d'<a href=\"http://vosdroits.service-public.fr/associations/F1131.xhtml\" target=\"_blank\">utilité publique</a> !",
    "page_h2":"Vos avis",
    "page_content":"<p>Quelques commentaires des fans :</p><blockquote><p>Des tutoriels très clairs, des articles toujours à la pointe de l'actualité !</p></blockquote><blockquote><p>Vous obtenez des avis de \"pros\" dans le forum d'Alsacreations.com !</p></blockquote><blockquote><p>Ma veille technologique passe par le flux RSS et la timeline Twitter d'Alsacreations.com !</p></blockquote>",
    "footer_text":"© Alsacreafans.com - 2015 | Cet exemple de page HTML n'est pas de la responsabilité d'Alsacreations.com et n'a été mis en place que pour des raisons didactiques. Jojaba."
}
                en.json
                {
    "head_title":"The official Alsacreafans Homepage",
    "head_description":"The Alsacreations.com fans community",
    "site_h1":"Alsacreafans",
    "site_description":"We believe that Alsacreations.com is a <a href=\"http://vosdroits.service-public.fr/associations/F1131.xhtml\" target=\"_blank\">public interest</a> initiative!",
    "page_h2":"Your reviews",
    "page_content":"<p>Some fans comments:</p><blockquote><p>Clear tutorials, articles always uptodate!</p></blockquote><blockquote><p>You get \"pro\" advices in the Alsacreations.com forum!</p></blockquote><blockquote><p>My technology watch goes through the Alsacreations.com RSS feed and Twitter timeline!</p></blockquote>",
    "footer_text":"© Alsacreafans.com 2015 | Disclaimer: This HTML page example is not an Alsacreations.com initiative and has been created for educational purposes. Jojaba."
}