Welcome Guest, Not a member yet? Register   Sign In
MY_Controller extended Controller class
#8

[eluser]gazugafan[/eluser]
It looks like passing FALSE to $this->layout to disable loading a layout isn't working quite right. I think the _load_view function should be changed to this...

Code:
private function _load_view() {
        if ($this->view !== FALSE) {
            $view = ($this->view !== null) ? $this->view . '.php' : $this->router->class . '/' . $this->router->method . '.php';

            $data['yield'] =  $this->prerendered_data;
            $data['yield'] .= $this->load->view($view, $this->data, TRUE);

            if (!empty($this->asides)) {
                foreach ($this->asides as $name => $file) {
                    $data['yield_'.$name] = $this->load->view($file, $this->data, TRUE);
                }
            }

            $data = array_merge($this->data, $data);

            if (!isset($this->layout)) {
                if (file_exists(APPPATH . 'views/layouts/' . $this->router->class . '.php')) {
                    $this->load->view('layouts/' . $this->router->class . '.php', $data);
                } else {
                  $this->load->view('layouts/application.php', $data);
                }
            } elseif ($this->layout === FALSE) {
                echo($data['yield']);
            } else {
                $this->load->view('layouts/' . $this->layout . '.php', $data);
            }
        }
    }

Seems to do the trick for me! Love these base classes you came up with btw--they're great!


Messages In This Thread
MY_Controller extended Controller class - by El Forum - 12-02-2009, 03:17 AM
MY_Controller extended Controller class - by El Forum - 12-03-2009, 05:27 AM
MY_Controller extended Controller class - by El Forum - 12-03-2009, 06:13 AM
MY_Controller extended Controller class - by El Forum - 12-03-2009, 10:24 AM
MY_Controller extended Controller class - by El Forum - 12-03-2009, 10:30 AM
MY_Controller extended Controller class - by El Forum - 12-04-2009, 02:31 AM
MY_Controller extended Controller class - by El Forum - 12-17-2009, 11:33 AM
MY_Controller extended Controller class - by El Forum - 01-06-2010, 11:04 PM
MY_Controller extended Controller class - by El Forum - 03-31-2010, 11:08 AM
MY_Controller extended Controller class - by El Forum - 04-02-2010, 06:53 PM
MY_Controller extended Controller class - by El Forum - 04-02-2010, 07:32 PM
MY_Controller extended Controller class - by El Forum - 04-03-2010, 03:43 AM
MY_Controller extended Controller class - by El Forum - 07-12-2010, 05:21 AM
MY_Controller extended Controller class - by El Forum - 07-12-2010, 08:44 AM
MY_Controller extended Controller class - by El Forum - 10-03-2010, 08:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB