Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported use of @php directive #2012

Closed
collegeman opened this issue Jan 3, 2018 · 3 comments
Closed

Unsupported use of @php directive #2012

collegeman opened this issue Jan 3, 2018 · 3 comments

Comments

@collegeman
Copy link

Dear amazing people at Roots;

I want to draw your attention to this issue I reported in the Laravel project. It seems using the @php directive in what I've been calling the "single-tag-form" is no longer supported. The reason being that if there are any @endphp closing tags used in the same template, all of the content between the first @php and the last @endphp will be evaluated by the compiler to be of the same directive, resulting in unintended behavior, e.g., the intervening template code being printed to the screen.

Here's an example of the way you're using it:

<html @php(language_attributes())>

This way that you're using the @php directive is functional, but only in isolation to the block-form that includes both the @php and @endphp tags.

@roots-ladybug
Copy link

Hi @collegeman,

It looks like the issue template is missing from this issue. Please take a look at the Contribution Guidelines, which will tell you exactly what your ticket has to contain in order to be processable.

Please do not use the issue tracker for personal support requests (use the Roots Discourse to ask the Roots Community for help, or if you want the Roots Team to dedicate some time to your issue, we offer our services as well).

@retlehs retlehs reopened this Feb 3, 2018
@collegeman
Copy link
Author

@roots-ladybug spanked me! 🐞

@elementalhub
Copy link

elementalhub commented Mar 27, 2018

Also if you're using vscode and the Laravel Blade Snippets extension, emmet won't recognize anything after a @php() directive as "blade". Therefore snippets won't work and syntax highlighting is funny, for example comment syntax will be like
// foo
instead of
{{-- foo --}}

That's why I changed all the @php() directives to @php @endphp tags.
(Just in case anyone stumbles upon this as well and spent as much time as I figuring out why emmet wasn't working in my blade views.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants