Matanya
Matanya

Reputation: 6346

Blade templating engine syntax issues on Laravel 4

I'm currently starting a project on the beta version of Laravel 4

When i try to use the templating engine some tags work and some doesn't. e.g:

@layout('layouts.master')
@section('container')
    <h1>About US</h1>
@endsection

is displayed as:

@layout('layouts.master')

About US

@endsection

which means that the @section tag is parsed, but the other are referred to as plain text. also if i change the @layout to @include, it does include the template.

Has anyone run into a similar issue? Have there been any syntax changes I'm unaware of?

Upvotes: 14

Views: 4811

Answers (3)

Dave Snijder
Dave Snijder

Reputation: 31

The source of the problem is that a lot of tutorials online (youtube and blogs) still use the @layout and @endsection. And these tutorials usually claim to be Laravel4 tutorials as well.

So a lot of people fall in to this little trap starting their first Laravel4 app.

Tip: I use this guy's cheat sheet page while developing (propers to Jesse O'Brien). It's how I found out myself I was using outdated blade tags.

Upvotes: 2

Markus Hofmann
Markus Hofmann

Reputation: 3447

If you come across problems with Laravel or in case you don't know if Laravel has built in a functionality you'd need, allways check out the docs for the Laravel version you use.

The online documentation of the current released version (4 at the time of writing): http://laravel.com/docs/

and the Laravel API to dive into the source online with explanation of e.g. function arguments: http://laravel.com/api/

Upvotes: 0

TaylorOtwell
TaylorOtwell

Reputation: 7337

@layout has been changed to @extends in Laravel 4. Also, @endsection has been changed to @stop

Upvotes: 42

Related Questions