problem with array - multilingual page


Posted on 16th Feb 2014 07:03 pm by admin

this is my test page :
Code: <?php
if(isset($_GET['lang'])) {
if($_GET['lang'] == "en") {
require_once("languages/lang-en.php");
}
elseif($_GET['lang'] == "fr") {
require_once("languages/lang-fr.php");
}
elseif($_GET['lang'] == "ar") {
require_once("languages/lang-ar.php");
}
} else {
require_once("languages/lang-fr.php");
}
?>
<html>
<head>
<title><?php echo $lang['title']; ?></title>
</head>
<body>
<div id="content">
<h1><?php $lang['title']; ?></h1>
<?php $lang['content']; ?>
<br/>
</div>
<div id="footer">
<?php $lang['footer']; ?>
</div>
</body>
</html>

and here is my included file :
Code: <?php
// english version
$lang = array();

$lang['title'] = "Welcome to My site !";
$lang['content'] = "<p>Well this is my first time setting up a multilingual website, i hope it works.</p>";
$lang['footer'] = "All rights reserved for UML (C) ".date("Y", time());
$lang['error'] = "Sorry, you cannot add words unless you're logged in !";
?>
the problem is that page displays the head title only !!!!
what should i do???

No comments posted yet

Your Answer:

Login to answer
134 Like 17 Dislike
Previous forums Next forums
Other forums

Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I

How to make URL loads only on login
On my page, when a user login he's redirects to user_home.php. I made it also to open the chat scree

MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
We have SAP XMII 12.0 setup running on Netweaver 2004s,7.0, Java Stack only.

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

php wont update my db
hello,

sorry for posting in mysql forum but i dont know where exactly is the problem but here

Why use interfaces in PHP (OOP)
I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't unders

Why does this file not return file names that start with numbers?
This file returns a list of filenames to help populate a drop down in my form. For some reason it ig

Searching keywords from array
Hello everyone, Im just wondering if someone could help me with another issue im having. Im still le

need help in mysql_num_rows()
please tell me what i am doing wrong in this query. it displays this error

Code: Warning: mys

Amatuer requiring assistance
Beginner and amateur in need of assistance

My Site - (Spare Parts for Domestic Appliances)

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash