Angelo Berçacola
Angelo Berçacola

Reputation: 173

when i load session class the page do not load CodeIgniter

I'm using CodeIgniter 2.1.3 and when i try to load session class the page don't load, and don't show any error either , look what i'm trying to do: ( P.S.: I've set the encryption key already ) ( It is the index of the main controller... )

   public function index() {

    $this->load->library('session');

    $this->load->helper('assets_helper');


    $data['assets_url'] = assets_url();

    $this->load->view(domain_template() . '/index', $data);

}

If i do like above, the code will no load the page, but if i put like that:

    public function index() {

    //$this->load->library('session');

    $this->load->helper('assets_helper');


    $data['assets_url'] = assets_url();

    $this->load->view(domain_template() . '/index', $data);

}

It's loaded, why it happen? i cant solve it!!

Upvotes: 1

Views: 1509

Answers (2)

RamiroRS
RamiroRS

Reputation: 461

I allways load session on autoload, but if you want to load on specific controller use:

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

class Perfil extends CI_Controller {

function __construct()
{
    parent::__construct();
    $this->load->library('session');
}

function index() {

}

On MAMP errors are not diplayed by default. you shoud activate.

Upvotes: 0

JDHankle
JDHankle

Reputation: 74

Set your CI environment to DEVELOPMENT to display errors, follow Collins suggestion for enabling error reporting at the configuration level as well. You may also wish to tail your logs. On a LAMP stack it's /var/log/apache2/error_log or /var/log/httpd/error_log. Use tail -f PATH_TO_ERRORLOG and reload the page and see what happens.

Upvotes: 1

Related Questions