user2051012
user2051012

Reputation: 95

Laravel Blade Layouts

This is the problem, its not reading @layout()

its not reading

Inside the folder View/authors/index.blade.php

@layout('layouts.default')

@section('content')

Authors Home Page

@endsection

In the folder Controllers/authors.php

class Authors_Controller extends Base_Controller{

  public $restful = true;

  public function get_index(){
      return View::make('authors.index')->with('title', 'Autores e Livros');
  }

}

and inside the folder View/layouts/default.blade.php

basic html

<html>
<head> <title> {{ $title }} </title> </head>
<body>
{{ $content }}
</body>
</html>

Where's my error? why is it not reading?

Folder

Upvotes: 2

Views: 5541

Answers (2)

Shnd
Shnd

Reputation: 2050

It seems in Laravel 4 you should use @extends('layouts.default') instead of @layout('layouts.default')

Upvotes: 3

Mr. Sensitive
Mr. Sensitive

Reputation: 685

First: Inside View/layouts/default.blade.php

<html>
<head> <title> {{ $title }} </title> </head>
<body>
  @yield('content')
</body>
</html>

And second: Update

I'm like 99% sure that '@layout('layouts.default')' in your View/authors/index.blade.php is not on the first line. It has to be at the top of the page.

Upvotes: 5

Related Questions