anbu icon indicating copy to clipboard operation
anbu copied to clipboard

Support Laravel 5.0 Blade Syntax

Open mikedugan opened this issue 10 years ago • 7 comments

For better or for worse, default blade syntax for HTML in L5 is now {!! $var !!}.

Local workaround:

  • views/index.blade.php - change {{ $child }} to {!! $child !!}
  • Modules/Debug/default.blade.php - change {{ $debug }} to {!! $debug !!}
  • Modules/History/default.blade.php - change {{ $history->links() }} to {!! $history->links() !!}
  • Modules/Info/default.blade.php - change {{ $info }} to {!! $info !!}
  • Modules/Dashboard/default.blade.php - change {{ $widget->view }} to {!! $widget->view !!}

Alternatively, you theoretically should be able to bind the old escaped echo delimiters to Blade using \Blade::setEscapedContentTags('{{', '}}'), but I'm having trouble getting that to work (tried it at the end of the BaseController constructor).

Great work! Can't wait to see this evolve over time!

mikedugan avatar Sep 17 '14 12:09 mikedugan

Thanks man. Trying to decide how to do this without breaking 4.2. Cheers for the issue!

daylerees avatar Sep 17 '14 12:09 daylerees

Definitely. I don't see where you grab the Laravel version, but you could do a quick check on that and then set the blade syntax...or you could probably just set the syntax anyway, if it's already working it'll keep working, if it's not then it will/should.

mikedugan avatar Sep 17 '14 12:09 mikedugan

I could check against the version, but it might be a bit nasty that way :) I'll have a play with it mate.

daylerees avatar Sep 17 '14 12:09 daylerees

Related: https://github.com/laravel/framework/pull/5758

If/when that is fixed, it should be trivial to set Blade to use the 4.* syntax

mikedugan avatar Sep 17 '14 13:09 mikedugan

Is it possible to create two versions of the package? One for 4.2 and the other one for 5.0?

foxted avatar Sep 23 '14 20:09 foxted

It shouldn't be necessary (to maintain separate versions) once the issue with quoted tags mentioned above is resolved. Once that's done, it can be set via Blade::setRawTags('{{', '}}')

mikedugan avatar Sep 23 '14 21:09 mikedugan

a quick way would be a new "develop" branch for Laravel 5 and the master with 4.2 ;)

tyloo avatar Oct 03 '14 15:10 tyloo