I am calling this and not including layouts.app on a custom page, because I want to have a different header then on the other pages. I suddenly get this error without changing anything. Seems like my blade templates don’t build. Any hints?
It’s possible those templates were compiled with an earlier version of Blade before this change was made and therefore they are still ok (I don’t think they should be recompiled unless the .blade.php file is updated).
You could test that theory by making a simple change to one of the working template files and see if it ends up broken suddenly.
I had to make a custom blade directive some time ago to get this to work, always assumed it was a bug. Something like @run( %codehere% ), don’t remember the detail but it worked like the old @php().
@Stephen That issue is for version 5.5. Sage is using 5.4. I am wondering why this is actually happening.
At any rate, blocks of @php ... @endphp code look nice, especially if they are conditionals or loops. And as some have mentioned, stick with the <?php something(); ?> for inline code. I even like to echo with <?= $variable ?> just out of habit.
@Webstractions - good catch! I don’t know what would be causing it then… It seems that it was never the intended behaviour to work without @endphp so maybe in some setups, it causes the a different result. It’s hard to say without digging into it a lot deeper.
I’ll stick to the full syntax if I need PHP. For variables, I prefer the Blade {{ $variable }} syntax - it’s just that bit faster to type and you get the HTML escaping thrown in as part of it.