CodeIgniter Forums
Profiler fails if model is assigned an alias - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Profiler fails if model is assigned an alias (/showthread.php?tid=20127)



Profiler fails if model is assigned an alias - El Forum - 06-29-2009

[eluser]Unknown[/eluser]
Hi There

Not sure if this is a known bug or not but I did do a search and couldn't find anything on it.

I've been using the profiler to optimize my application.

It works absolutely fine unless I assign my model a different name.

for example this works fine:

Code:
class Pages extends Controller {

    function Pages()
    {
        parent::Controller();    
        $this->load->model('Pages_model');
        $this->output->enable_profiler(TRUE);
    }

    function index()
    {
        $data = array(
            'page'=>$this->Pages_model->get_page()
        );
        $this->load->view('pages-view',$data);
    }
}

But this fails (just a blank screen):

Code:
class Pages extends Controller {

    function Pages()
    {
        parent::Controller();    
        $this->load->model('Pages_model', 'pages');
        $this->output->enable_profiler(TRUE);
    }

    function index()
    {
        $data = array(
            'page'=>$this->pages->get_page()
        );
        $this->load->view('pages-view',$data);
    }
}

It definitely seems to be the alias that causes it to fail.
Has anyone else had this experience or is it a know issue?

Cheers


Profiler fails if model is assigned an alias - El Forum - 06-29-2009

[eluser]Dam1an[/eluser]
I've never had this problem, as use the profiler and model aliases all the time
The only differance is I load the profiler in MY_Controller, so it happens before the model, might be worth seeing if that makes a difference...