Welcome Guest, Not a member yet? Register   Sign In
Need Help Not Loading Language File
#1

[eluser]razerone[/eluser]
Hello

I am trying to set up my language files been reading through user guide but not working.

Controller.php

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Header extends CI_Controller {

public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->helper('language');
        $this->lang->load('language');
    }

function index() {
        $this->lang->load('header', 'en');
        //$this->data['text_title'] = $this->language->get('text_title');

  $this->load->view('header', $data);

}

}

Language header.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$lang['text_title'] = 'Your Title';

?>

view header.php
Code:
<title><?php echo lang('text_title'); ?></title>
#2

[eluser]Tpojka[/eluser]
Is this part ok to you:
Code:
$this->lang->load('language');
, because -
Code:
$this->lang->load('filename', 'language');
and -
Quote:Where filename is the name of the file you wish to load (without the file extension), and language is the language set containing it (ie, english). If the second parameter is missing, the default language set in your application/config/config.php file will be used.
Consider code from user guide:
Code:
$this->lang->load('filename', 'language');
as:
Code:
$this->lang->load('about_page', 'english');
where you can escape second parameter.
'Language' is not key you wanted there, maybe.




Theme © iAndrew 2016 - Forum software by © MyBB