Does `the_post()` make my templates crash? Clean Sage 11 install

Hey all, I was having a lot of syntax error messages about @. I’ve tried to narrow it down to a clean install of sage 11. Especially when using @php@endphp.

This errors:

@extends('layouts.app')

@section('content')
  @while(have_posts()) @php(the_post())
  @php
    $classes = '';
  @endphp

  <article @class($classes)>
  </article>
  @endwhile
@endsection

This does not error:

@extendsextends(‘layouts.@sectionpp’)

@secti@whilen(‘content’)@wh@phple(have_posts())

@phpthe_post();$classes = ‘’;@endphp

<article @class($classes)>
  </article>
  @endwhile
@endsection

Is @php(the_post()) the culprit? Or am I abusing blade wildly all of a sudden?

You can’t mix the short

@php()

and

@php @endphp

in one template

3 Likes

hah, for real? Is this the first time in 5 years I run into this? And that often in one project?

oh damn, yes. This works again.
``` @extends(‘layouts.app’)

@section(‘content’)
@while(have_posts())
@php(the_post())

@php($classes = '')

<article @class($classes)>
</article>

@endwhile
@endsection
```