CodeIgniter Forums

Full Version: Missing argument 1 for Layout::__construct(), called in C:\Xampp\htdocs\system\core\Loader.php on line 950 and defined
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
I have started to create a new library called Layout and I have successfully loaded the library but somehow, it is not passing the arguments correctly and I received the following error message.

Code:
A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for Layout::__construct(), called in C:\Xampp\htdocs\system\core\Loader.php on line 950 and defined

Filename: libraries/Layout.php

Line Number: 17

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: layout

Filename: libraries/Layout.php

Line Number: 19

Below are the codes for the constructor.

Code:
class Layout {
    var $obj;
    var $layout;
    var $js;
    var $css;
    var $placeholder;

    public function __construct($layout) {
        $this->obj =& get_instance();
        $this->layout = $layout;
        $this->js = $this->css = $this->placeholder = array();
    }
}

Below are the constructor codes for my controller.

Code:
class Home extends MY_Controller {

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

I appreciate who can help me in this. Thanks.

El Forum

[eluser]InsiteFX[/eluser]
Code:
class Layout {
    var $obj;
    var $layout;
    var $js;
    var $css;
    var $placeholder;

    public function __construct($layout = '') {
        $this->obj =& get_instance();
        $this->layout = $layout;
        $this->js = $this->css = $this->placeholder = array();
    }
}

InsiteFX

El Forum

[eluser]Unknown[/eluser]
Thanks for replying, InsiteFX but I got the following error code.

Code:
An Error Was Encountered

Unable to load the requested file: .php

Even if I follow the user guide, it is still not working. Seems like a bug to me.

Any help with this?