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

Blade block comment {{-- with <?php ?> --}} not working #20060

Closed
radoslavv opened this issue Jul 14, 2017 · 5 comments
Closed

Blade block comment {{-- with <?php ?> --}} not working #20060

radoslavv opened this issue Jul 14, 2017 · 5 comments

Comments

@radoslavv
Copy link

  • Laravel Version: 5.4.25
  • PHP Version: PHP 7.1.4 (cli) (built: Apr 11 2017 20:08:12)
  • Database Driver & Version: does not matter

Description:

blade block comment does not work

Steps To Reproduce:

Code like test.blade.php with:

    {{-- comment 1
        <?php
            echo 'comment 1'
        ?>
    --}}
    {{-- comment 2
        <?php
            echo 'comment 2'
        ?>
    --}}
    {{-- comment 3
        <?php
            echo 'comment 3'
        ?>
    --}}
    {{-- comment 4
        <?php
            echo 'comment 4'
        ?>
    --}}

results into HTML code like comment completely ignored and everything inside executed:

    {{-- comment 1
        comment 1    --}}
    {{-- comment 2
        comment 2    --}}
    {{-- comment 3
        comment 3    --}}
    {{-- comment 4
        comment 4    --}}
@sileence
Copy link
Contributor

Please try using the @php @endphptags instead. These should be ignored by Blade.

@sileence
Copy link
Contributor

sileence commented Jul 14, 2017

This works as expected:

                {{--
                @php

                    echo "Hello world!";

                @endphp
                --}}

echo "Hello world!"; is not printed.

@sileence
Copy link
Contributor

I have another possible solution for this issue, in case #20065 is merged :)

@radoslavv
Copy link
Author

@php
@endphp
is a working workaround :-)

@trainoasis
Copy link

@php @endphp is not ok with i18n tools like poedit or certain built-in tools (which you cant edit) that scan only php tags for i18n strings. It was bad enough I had to change all my {{}} with __() strings to be inside <?php ?>. I guess no other options here?

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