anbu
anbu copied to clipboard
Support Laravel 5.0 Blade Syntax
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!
Thanks man. Trying to decide how to do this without breaking 4.2. Cheers for the issue!
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.
I could check against the version, but it might be a bit nasty that way :) I'll have a play with it mate.
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
Is it possible to create two versions of the package? One for 4.2 and the other one for 5.0?
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('{{', '}}')
a quick way would be a new "develop" branch for Laravel 5 and the master with 4.2 ;)