Laravel 4 Blade {{}} and Hogan.js {{}} Syntax

自古美人都是妖i 提交于 2019-12-22 04:42:42

问题


I am using Laravel 4 with the Blade Templating Engine and Hogan.js.

By default my site thinks {{...}} is used by PHP and Laravel. Now I want to use Hogan.js and the syntax is {{...}} too. I am getting an error, because they use the same syntax here.

How can I use both?


回答1:


You can prepend @ to your Hogan placeholders, and Laravel will ignore them.

// This will work only in JavaScript
@{{ JavaScript }}

// This will be rendered in blade
{{ $foo }}


来源:https://stackoverflow.com/questions/20432935/laravel-4-blade-and-hogan-js-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!