Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:10:19+00:00 2026-06-13T06:10:19+00:00

Im working on a website and wanted to make it multy language. I found

  • 0

Im working on a website and wanted to make it multy language.
I found a multy lamguage script on the internet.
I added the files and the php redirect to my site.
It works fine for the pages in my root dir but it doesnt seem to work on the php files located in other dirs in my root.
root/main.php works fine but root/admin/admin.php aint working.
it gives an error that the server cant find my lang file.
my lang files are located in root/lang/ and the php script is located in root/include/session.php.

here a copy of the script

session_start();

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 'nl':
  $lang_file = 'lang.nl.php';
  break;


  default:
  $lang_file = 'lang.en.php';

 }
 include_once 'lang/'.$lang_file;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:10:20+00:00Added an answer on June 13, 2026 at 6:10 am

    You have just to include with a relative path, relative to the current script (session.php)

    include_once dirname(__FILE__).'/lang/lang.en.php';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have working website in PHP with a MySQL backend which has several tables
Im working on a website (html,css,javascript, ajax, php,mysql), and I want to restrict the
I'm working on improving the security of my company's website and wanted to create
I'm working on a simple CSS and HTML website, trying stuff out. I wanted
For a website I'm working on, the client wanted to use Roboto (by Google)
I'm working on a website, and I wanted to show it to someone. So
I am working on a new site and wanted to figure out how Apple
I am working on setting up a Drupal based website and wanted to replace
I am working on a website: http://homegym.sg/index.php/ Have used jquery to create an effect
I was working on a website for a client. I wanted to re-write a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.