I call the php file as follows using Fancybox
index.php:
<div class="pic">
<a id="showcase1" href="showcase/showcase1.php"><img src="images/showcase1t.png"/></a>
</div>
inside showcase/showcase1.phpI have the following code:
<?php include_once '../localization.php'; ?>
<div id="inline">
<img src="images/showcase2.png"/>
<?php echo l('inline_p'); ?>
<a href="http://studyatbest.com"><?php echo l('inline_a'); ?></a>
</div>
which calls the values inside the array from the language file ( lang.en.php):
'inline_p' => ' <p><strong>Previous</strong> = Left Arrow Key</p>
<p><strong>Next</strong> = Right Arrow Key</p>
<p><strong>Close</strong> = Esc</p>',
'inline_a' => 'Visit',
helps the "controller" ( localization.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 'es':
$lang_file = 'lang.es.php';
break;
case 'zh-tw':
$lang_file = 'lang.zh-tw.php';
break;
case 'zh-cn':
$lang_file = 'lang.zh-cn.php';
break;
default:
$lang_file = 'lang.en.php';
}
function l($localization) {
global $lang;
return $lang[$localization];
}
include_once 'languages/'.$lang_file;
?>
The matrix perfectly displays the values in the language files if I open it directly showcase/showcase1.php, but when it is called from the binding using fancybox, it says:
Fatal error: call undefined function l () in D: \ WAMP \ WWW \ projects \ alexchen \ alexchen2.6 \ showcase \ showcase1.php on line 3
Any suggestions?
:
l - , (. localization.php).