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 6131219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:56:55+00:00 2026-05-23T16:56:55+00:00

i want to make the site with multi languages and selecting the language with

  • 0

i want to make the site with multi languages and selecting the language with ajax and the different words will be selected from database and i want to use session[lang],and i don’t want to use GET[lang].
i’m trying from 5 days to make this but i try so many variants and i’m confused now

now i’m here:

i have model -> Langs ->

function set_langs($arg)  {
  $this->session->unset_userdata(‘lang’);
  $this->session->set_userdata(‘lang’, $arg);
  return $arg;
}
function get_langs()  {
  return $this->session->userdata(‘lang’);
}

in the Home controller ->

public function index(){
  if($this->session->userdata(‘lang’)==’‘){
  $this->Langs->set_langs(‘en’);
  $glang[‘lang’] = $this->Langs->get_langs();
  }else{
  $glang[‘lang’] = $this->Langs->get_langs();
  }
$this->load->view(‘header’, $glang);
}
 public function set()
{
  if($_POST && $_POST[‘lang’] != NULL) {
    $this->Langs->set_langs($_POST[‘lang’]);
    $return[‘error’] = false;
    $return[‘msg’] = $this->session->userdata(‘lang’).’ ok!’;
    echo json_encode($return);
  }else{...}

}

and in the header.php -> in the JS ->

$.ajax({
  type: “POST”,
  url: “index.php/home/set”,
  dataType : ‘json’,
  data: “lang=”+lang,
    success: function(data){
    if(data.error === true){
    $( “#dialog-message2” ).text(data.msg).dialog({
    modal: true,
    buttons: {
    Ok: function() {
    $( this ).dialog( “close” );[removed]=location.href;
                      }
                    }
                  });
            }else{...}

when the page refresh the language stil not changed but when return the message from ajax it work
so where im wrong
sorry for the bad english
thanks

* the problem was -> system/libraries/Session.php (the original file from the CodeIgniter_2.0.2.zip) -> i download http://codeigniter.com/wiki/File:CI_1.5.1_with_Session.zip/ and no problems

  • 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-05-23T16:56:56+00:00Added an answer on May 23, 2026 at 4:56 pm
    • the problem was -> system/libraries/Session.php (the original file from the CodeIgniter_2.0.2.zip) -> i download http://codeigniter.com/wiki/File:CI_1.5.1_with_Session.zip/ and no problems
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a multi-language site, such that all or almost all pages
Hello I want to make my site displayed in different languages. I had idea
I want to make a program that will simulate a user browsing a site
i want make a news site gets its content from other news sites, open
I want to make a site, and I've learned a few languages, but I
I want to make a site use wp, and I want add a scroll
I want to make sure rogue users can't damage my site or database by
I want to know what could be the best way to make multi-site with
I want to make a site where there user can basically navigate the web
I have a site running in django and want to make it available on

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.