CodeIgniter Forums
Flashdata, language file and constructor [solved] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Flashdata, language file and constructor [solved] (/showthread.php?tid=34002)



Flashdata, language file and constructor [solved] - El Forum - 09-15-2010

[eluser]Unknown[/eluser]
Howdy all! I'm new here and I have been working with CI few weeks now and I now I'm stuck with this little problem.

Main problem below is that flashdata goes thru, but it's empty. If I change 'login_access_rights' to something static text, it works just fine. So can I use (autoloaded) language file in controllers constructor if there is a redirect?


Code:
class Admin extends Controller {

    function Admin()
    {
        parent::Controller();    
        
        if(!$this->user_model->Secure(array('userType' => array('user','admin'))))
        {    
            $this->session->set_flashdata('flashError', $this->lang->line('login_access_rights'));
            redirect('login');    
        }
    }

Edit:
Problem solved, It had nothing to do with constructors, just poorly made stylesheet what made too long message disappear.