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

  • SEARCH
  • Home
  • 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 8719667
In Process

The Archive Base Latest Questions

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

I have an application build in Codeigniter framework.which have functionality of multi language.It works

  • 0

I have an application build in Codeigniter framework.which have functionality of multi language.It works fine In view to convert the each line.But for alert messages which is set from controller i try to use the language key but failed to show the message on view in multi language.

Here is the code of controller from the message has been set to show on view:-

the function of controller to set the message:

function serial_coupon()
    {
     $admin_session_data= $this->session->userdata('user_logged_in');
     $key=$this->input->post('serial');
     $res=explode("000",$key);
     $key=$res[1];
     $result['coupon']=$this->provider_model->get_coupon($key);
          if(empty($result['coupon']))
           {
                       $msg=$this->lang->line('language_srch_msg');
               $this -> session -> set_flashdata('message',$msg);//if no search found than set the message.
               redirect('/provider/');//provider is controller
           }
           else
           {

               $this->load->view('header',$admin_session_data);
               $this->load->view('show_coupon',$result);
               $this->load->view('footer',$admin_session_data);
           }
    }

Hence it comes to the Provider controller’s Index Function to send the message on view:-

function index()
        {
            $msg=$this->session->flashdata('message');//get the message 
            $result['msg']=$msg;and set to the array to send in view

                $result['rows']=$this->session->userdata('provider_detail');
        $user_id=$result['rows'][0]['id'];
            $result['coupons']=$this->provider_model->show_coupons($user_id);
            $this->load->view('header');
            $this->load->view('provider_interface',$result);
        $this->load->view('footer');

    }

So the message should be display in view:

<p><?php echo $msg; ?></p>

And the other lines where i am using language key Like:
for name:

<?php echo $this->lang->line('language_name');?>

Now please Let me know how can i use the above language key for message in controller??

Thanks In advance and still any doubt feel free to Ask.

Short description :
the problem is not to show the falshdata message.i want the message should be in a particular language in which the user selected.my application in multi language in which the user can select the language from drop down box.and the whole content in convert in to the selected language .but the alert messages comes from controller so how can i convert them in selected language?

I changed my code in function search_coupon but it works for only English language not for Portuguese.Here is my constructor code of provider controller:

public function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->helper('form');
            $this->load->library('session');
            $this->load->model('provider_model');

            $lng=$this->session->userdata('about_language');

                 if($lng=='' ) 
                 {

                $this->load->language('language','english');

                 }
                 else
                 {

                $this->load->language('language',$lng);

                 }



            if($this->session->userdata('provider')=="")
            {
              redirect('/login/', 'refresh');   
            }


        }

Code for select The language using ajax:

<script type="text/javascript">
         jQuery(document).ready(function() {
          jQuery('#port').click(function(){
                                    var dummy = 2;
                                    $.ajax({
                                            type: "POST",
                                            url: "<?php echo BASE_PATH; ?>/session/sessions",
                                        data: "&ID="+dummy+ "&lang="+'portuguese',
                                            success: function(response)
                                                {

                                                    if (response == false)
                                                        {   
                                                            location.reload();

                                                        }  
                                                }
                                           });

                                   });

            jQuery('#eng').click(function(){
                                        var dummy = 1;
                                        $.ajax({
                                                    type: "POST",
                                                    url: "<?php echo BASE_PATH; ?>/session/sessions",
                                                 data: "&ID="+dummy+ "&lang="+'english',
                                                    success: function(response)
                                                        {

                                                            if (response == false)
                                                                {
                                                                    location.reload();
                                                                }
                                                        }
                                                });

                                         });
         });
          </script> 

And here is the session controller :

function sessions(){

         $value=  $this->input->post('ID');
         $lang=  $this->input->post('lang');

         $lang=$this->session->set_userdata('about_language',$lang);
         return $lang;
        }
  • 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:51:17+00:00Added an answer on June 13, 2026 at 6:51 am

    One solution, perhaps not the best, is to store in the flash var the message key instead of the message. At this moment you are storing:

    $this -> session -> set_flashdata('message','No Search Found Of This Serial Number');//if no search found than set the message.
    

    and then you are loading the message:

    $msg=$this->session->flashdata('message');//get the message 
    $result['msg']=$msg;
    

    And showed in the view:

    <p><?php echo $msg; ?></p>
    

    I proposed you this solution:

    $this -> session -> set_flashdata('message','message_key');//if no search found than set the message.
    

    $msg_key = $this->session->flashdata('message');//get the message key
    $result['msg_key'] = $msg_key;
    

    And in the view:

    <p><?php echo $this->lang->line('msg_key'); ?></p>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which i build using gcc on linux host for ARM
i have one application which is build using VB.NET now i required to add
I have a small problem with UINavigationController animation between two view. My application build
We have an WPF Application build on .net framework 3.5. Some testers find if
I have a web application built with jQuery Mobile and PHP (CodeIgniter framework). Now
I have a PHP web application built with CodeIgniter MVC framework. I wish to
I am using codeigniter php MVC framework to develop a web application. I have
I'm developing a web based application built on codeigniter which will also have a
I have develop one simple database application build using SilverLight5.0 + Entity Framework +
I have a multi-threaded application build in C# using VS2010 Professional. It's quite 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.