I have this in my index.php:
<?php include_once 'file.php' ?>
then I have <html> some content </html>
and I have this in file.php:
<?php
session_start();
header('Cache-control: private');
if(isSet($_GET['lang']))
{
$lang = $_GET['lang'];
$_SESSION['lang'] = $lang;
setcookie("lang", $lang, time() + (3600 * 24 * 30));
}
else if(isSet($_SESSION['lang']))
{
$lang = $_SESSION['lang'];
}
else if(isSet($_COOKIE['lang']))
{
$lang = $_COOKIE['lang'];
}
else
{
$lang = 'en';
}
switch ($lang) {
case 'en':
$lang_file = 'lang.en.php';
break;
case 'de':
$lang_file = 'lang.de.php';
break;
case 'es':
$lang_file = 'lang.es.php';
break;
default:
$lang_file = 'lang.en.php';
}
include_once 'languages/'.$lang_file;
?>
I have those 3 files, I mean lang.en.php an so on...
and it doesn't work, my page is empty, no text, why? What's wrong?
lang.en.php contains
<?php
$h1 ="HOME";
$h2 ="ABOUT US";
$h3 ="CONTACT";
$h4 ="FAQ";
$txt1 = "Here goes txt,Here goes txt,Here goes txt,Here goes txt,
Here goes txt,Here goes txt,Here goes txt,Here goes txt,
Here goes txt, Here goes txt,Here goes txt,Here goes txt.";
?>
I don't know what's wrong with this... What should I change? Can someone help me. Thanks.