To get it working for all 3 files, and additional language files if needed, do the following:
common.php:
PHP Code:
<?php
session_start();
header('Cache-control: private'); // IE 6 FIX
if(isSet($_GET['lang']))
{
$lang = $_GET['lang'];
// register the session and set the cookie
$_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 'sin':
$lang_file = 'lang.de.php';
break;
case 'tam':
$lang_file = 'lang.es.php';
break;
default:
$lang_file = 'lang.en.php';
}
include_once 'languages/'.$lang_file;
?>
<div class="rap">
<?php
foreach($lang['slideshow'] as $image) {
?>
<img src="extra/<?php echo $image; ?>" width="860" height="270" />
<?php
}
?>
</div>
lang.en.php:
PHP Code:
<?php
/*
------------------
Language: English
------------------
*/
// Define the images you want for this language in the array below
$images = array('../images/slide1.jpg', '../images/slide2.jpg', '../images/slide1.jpg', '../images/slide2.jpg');
$lang = array();
// slideshow
$lang['slideshow'] = $images;
$lang['PAGE_TITLE'] = 'Testing Page';
// Menu
$lang['Menu_Home'] = 'Home';
$lang['Menu_About_us'] = 'About Us';
?>
lang.de.php:
PHP Code:
<?php
/*
------------------
Language: Dutch
------------------
*/
// Define the images you want for this language in the array below
$images = array('../images/dutch1.jpg', '../images/dutch2.jpg', '../images/dutch3.jpg', '../images/dutch4.jpg');
$lang = array();
// slideshow
$lang['slideshow'] = $images;
$lang['PAGE_TITLE'] = 'Danish Page';
// Menu
$lang['Menu_Home'] = 'Home'; // (whatever "Home" is in Dutch)
$lang['Menu_About_us'] = 'About Us'; // (whatever "About Us" is in Dutch)
?>
lang.es.php:
PHP Code:
<?php
/*
------------------
Language: Spanish
------------------
*/
// Define the images you want for this language in the array below
$images = array('../images/diapositiva1.jpg', '../images/diapositiva2.jpg', '../images/diapositiva3.jpg', '../images/diapositiva4.jpg');
$lang = array();
// slideshow
$lang['slideshow'] = $images;
$lang['PAGE_TITLE'] = 'Pagina de Prueba';
// Menu
$lang['Menu_Home'] = 'Inicio';
$lang['Menu_About_us'] = 'Quiénes somos';
?>
That should do it for you.
Let me know how you get on.
Bookmarks