Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 master layout not rendering

I am having trouble rendering a view in my controller. I am currently running Laravel 4 and below is my code. (BTW, I am still learning Laravel particularly the latest version that has not been released yet. I find it a bad idea to learn from the older versions because there seems to be a lot of changes for the current one.)

controllers/PluginsController.php

class PluginsController extends BaseController {
    public function index()
    {
        return View::make('plugins.index')->with(array('title'=>"The Index Page"));
    }

views/plugins/index.blade.php

@layout('templates.master')

@section('header')
    <h1>The Header</h1>
@endsection

@section('content')
    testing the index.blade.php
@endsection


@section('footer')
    <div style="background:blue;">
        <h1>My Footer Goes Here</h1>
    </div>
@endsection

views/templates/master.blade.php

 <!doctype>
 <html>
    <head>
        <meta charset="UTF-8" />
        @yield('meta_info')
        <title>{{$title}}</title>
        @yield('scripts')
    </head>
    <body>
        <div id="header">
            @yield('header')
        </div>

        <div id="wrapper">
            @yield('content')
        </div>

        <div id="footer">
            @yield('footer')
        </div>
    </body>
 </html>
like image 364
gwinh Avatar asked May 26 '13 05:05

gwinh


1 Answers

you must use @extends instead of @layout, and @stop instead of @endsection

like image 182
Miguel Borges Avatar answered Sep 28 '22 21:09

Miguel Borges