commit: be4c6aa993cb3fb22d5960aaaa39918d6aa5ac64
parent d54fe618f5ce271003069d5c5ca04d120d77cae8
Author: lanodan <lanodan.delta@free.fr>
Date: Fri, 28 Feb 2014 18:51:39 +0100
Lang system
Diffstat:
15 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/.index.php.swp b/.index.php.swp
Binary files differ.
diff --git a/.links.php.swp b/.links.php.swp
Binary files differ.
diff --git a/.navbar.php.swp b/.navbar.php.swp
Binary files differ.
diff --git a/index.php b/index.php
@@ -1,17 +1,11 @@
<?php
-require_once('lang/lang.php');
-
-if (empty($p)) {
- $page['title']=mainPage;
-}
-
-$title=$page['title'].baseTitle;
+ include 'lang/lang.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
- <title><?=$title?></title>
+ <title><?=mainPage.baseTitle?></title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/navbar.css">
</head>
diff --git a/lang/.en.php.swo b/lang/.en.php.swo
Binary files differ.
diff --git a/lang/.en.php.swp b/lang/.en.php.swp
Binary files differ.
diff --git a/lang/.fr.php.swo b/lang/.fr.php.swo
Binary files differ.
diff --git a/lang/.fr.php.swp b/lang/.fr.php.swp
Binary files differ.
diff --git a/lang/.index.php.swp b/lang/.index.php.swp
Binary files differ.
diff --git a/lang/.lang.php.swp b/lang/.lang.php.swp
Binary files differ.
diff --git a/lang/en.php b/lang/en.php
@@ -2,7 +2,7 @@
/**
* @file
- * French language file.
+ * English language file.
*/
define('mainPage', 'Main Page');
diff --git a/lang/index.php b/lang/index.php
@@ -0,0 +1,9 @@
+<?php
+ $known_languages = array('fr', 'en'); ## just add new language here when you need
+ $lang = 'fr'; //default language setting
+ $lang = $_COOKIE['lang'];
+ $lang = $_GET['lang'];//let user define his lang setting
+
+ setcookie(lang, $lang);
+ header('Location: /')
+?>
diff --git a/lang/lang.php b/lang/lang.php
@@ -1,13 +1,12 @@
<?php
-$known_languages = array('fr', 'en'); ## just add new language here when you need
-session_start();
+ $known_languages = array('fr', 'en'); //just add new language here when you need
+ if (empty($_COOKIE['lang'])) {
+ setcookie(lang, 'fr');
+ $lang = 'fr';
+ } else {
+ $lang = $_COOKIE['lang'];
+ }
-$lang = 'fr'; //default language setting
-$lang = $_SESSION['lang'];
-$lang = $_GET['lang'];//let user define his lang setting
-if ($lang != $_SESSION['lang'] && in_array($lang, $known_languages)) {
- $_SESSION['lang'] = $lang;
-}
-include($lang.'.php');
+ include 'lang/'.$lang.'.php';
?>
diff --git a/links.php b/links.php
@@ -1,11 +1,11 @@
<?php
-require_once('lang/lang.php');
+ include 'lang/lang.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
- <title><?=$title?></title>
+ <title><?=links.baseTitle?></title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/navbar.css">
</head>
diff --git a/navbar.php b/navbar.php
@@ -22,8 +22,8 @@
<ul class="right">
<li>lang
<ul>
- <li><a href="/lang/lang?lang=fr">Francais</a></li>
- <li><a href="/lang/lang?lang=en">English</a></li>
+ <li><a href="/lang/?lang=fr">Francais</a></li>
+ <li><a href="/lang/?lang=en">English</a></li>
</ul>
</li>
<li><a href="/rss">RSS</a></li>