473,796 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change language works after refresh

My multilanguage website still doesn't work.... really it works after a
refresh:
when I first start the browser, I get the following error:

Warning: main(lang..inc. php) [function.main]: failed to open stream: No
such file or directory in C:\wampp2\htdoc s\set_language. php on line 6

Fatal error: main() [function.requir e]: Failed opening required
'lang..inc.php' (include_path=' \wampp2\php\pea r\') in
C:\wampp2\htdoc s\set_language. php on line 6

then I make refresh and it works good. Here's my code:

main.php
<?
session_start() ;
define("DEFAULT _LANGUAGE", 'ge');
if (!isset($_SESSI ON['lang'])) {
$_SESSION['lang'] = DEFAULT_LANGUAG E;
}
include("set_la nguage.php");
?>
set_language.ph p
<?php
if (isset($_GET['lang']))
{
$lang = $_GET['lang'];
}
require_once("l ang.{$lang}.inc .php"); That's Line 6!!!
?>
<td align="left" width="50"><a href="?lang=ge" ><? echo "DEUTSCH"
?></a></td>
<td align="left" width="50"><a href="?lang=en" ><? echo "ENGLISH"
?></a></td>
<td align="left" width="50"><a href="?lang=sp" ><? echo "ESPAÑOL"
?></a></td>

Any help will be welcomed.

Jul 17 '05 #1
1 3318
be*****@coaster .ch wrote:
main.php
<?
session_start() ;
define("DEFAULT _LANGUAGE", 'ge');
if (!isset($_SESSI ON['lang'])) {
$_SESSION['lang'] = DEFAULT_LANGUAG E;
}
include("set_la nguage.php");


session_start() ;
define("DEFAULT _LANGUAGE", 'ge');

if (isset($_GET['lang'])) {
$_SESSION['lang'] = $_GET['lang'];
} else if (!isset($_SESSI ON['lang'])) {
$_SESSION['lang'] = DEFAULT_LANGUAG E;
}

$lang = $_SESSION['lang'];
include("set_la nguage.php");

And in set_language.ph p, to prevent it is called seperately:

if (basename($_SER VER['PHP_SELF']) != 'main.php')) {
header("Locatio n: http://{$_SERVER['HTTP_HOST']}/main.php");
exit;
}
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2377
by: Knud | last post by:
I have a frameset where a hidden frame reloads every 5 seconds and collects data from the sever if there are any changes made in a database. The hidden page updates Div fields on other frames with the lastest information. This works great. The problem I have is that when the hidden frame reloads it steals focus from the main frame where a user can be entering information into a form. (This is very annoying. As tabing through form...
2
4399
by: Galina | last post by:
Hello I have an application in MS Access 2000. I have a form, which includes a subform. The subform is based on a table, but locked for any editing. There is Edit button. When clicked, it starts a separate unbound form with all the fields, which are on the subform. The fields are filled in with data programmatically. User edits. Edited fields are copied into fields on the subform programmatically as well. I need to catch change in one of...
0
1352
by: sastwhc | last post by:
sastwhc wrote: > *Hi all > I try change language client side programatically.In my case farsi a > Right to Left Language,the curser direction changed by dir=rtl TAG > changed to correct direction but i dn't know how i can change the > language/keyboardLayout thats usually changed by using Alt+shift > manually in client side most function sendkey...the other functions > and methods i know them works in WIN Application Mode and not allowed...
4
16770
by: Tedmond | last post by:
Dear all, My application allows users to switch languages at run time. I use the following code to change the UI Culture but all controls are remaining unchanged. Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); Why? Anything that I need to do in order to refresh the controls?
3
4764
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a property based on CollectionBase class. like the following one : //------- XGrid.cs file --------------// public ColumnsCollection Columns {
7
1531
by: Fabio Mastria | last post by:
Looks like a joke... : As I say in the subject... I create a javascript file, with this function: function IndexChanged(source){ alert("Hallo");
7
9311
AccessIdiot
by: AccessIdiot | last post by:
This is driving me nuts. I have an unbound textbox (txt_SumSize) in my subform that holds the total of a field (Debitage_Size_Quantity)seen in datasheet view (control source =Sum(). I have an unbound textbox on my form (txt_SizeTotal) that gets the value from the subform footer when the form loads: Private Sub Form_Load() Me.txt_SizeTotal = Me!sbfrm_DEBITAGE_Size.Form! End Sub
2
2261
by: malcster2 | last post by:
hello, i am a beginner to ajax. i have created a mysql database, which i would like to access from a web page. i have created 3 files, a html to display the data, a php file to extract the data, and a javascript file to to the clever stuff. when i access the html page, all the data is displayed correcty, but if i add or delete any records, and press the button i have created to refresh the data(without reloading), the data doesn't change....
8
5168
by: ziycon | last post by:
I have a select option with two languages english and irish, and when the user selects one i use the onchange function to change the session language variable to the new language but the new lanaguage doesn't take effect until i refresh the current page or go to another page on the site, anyone any ideas? Is AJAX a bad idea to use for such a function?
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.