I have this in a codeigniter controller:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Test extends CI_Controller {
public $idioma;
public function index() {
parent::__construct();
// get the browser language.
$this->idioma = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
$data["idioma"] = $this->idioma;
$this->load->view('inicio', $data);
}
public function hello(){
$data["idioma"] = $this->idioma;
$this->load->hello('inicio', $data);
}
}
Inicio view:
<a href="test/hello">INICIO <?php echo $idioma ?></a>
hello view:
Hello <?php echo $idioma ?>
The inicio view works great, but when the hello view is loaded there's nothing displayed. Any idea why this is not working?
hello()doesn't have$this->idiomaset to anything.