How to load a view into a layout?

5
I'm trying to load a view into a layout , below my controller below:
class IndexController extends BaseController {
    protected $layout = 'admin.layouts.default';

    public function index()
    {
        $this->layout->$this->layoutcontent =  View::make('admin.index');
    }
}

However, you are returning the following error:

  

Attempt to assign non-object property

    
asked by anonymous 23.01.2014 / 23:58

2 answers

1

To include sub-views within the layout, it can be as follows:

@include('view.name')

Passing values:

@include('view.name', array('some'=>'data'))
    
29.01.2014 / 16:08
4

The error is in this section:

$this->layout->$this->layoutcontent =  View::make('admin.index');

The property is content but you have $this->layoutcontent , you should change to:

$this->layout->content = View::make('admin.index');

See also documentation at: Laravel - Controller Layouts (English)     

24.01.2014 / 01:07