I'm using a partial view to display page header, that view accepts two variables one is Icon the other is a title. pageHeader.blade.php:

<div class="page-header">
<div class="row">
    <!-- Page header, center on small screens -->
    <h1 class="col-xs-12 col-sm-4 text-center text-left-sm"><i class="fa {{$icon}} page-header-icon"></i>&nbsp;&nbsp;{{$title}}</h1>
</div>

and I'm using it like so:

@include('zdashboard._partials.pageHeader',['icon'=>'fa-pencil','title'=>'<strong>Editing</strong>'.$center->translations()->whereLang('en')->first()->name])

Sometimes I like to make one word strong or italic like the example above but, blade engine won't render the HTML tags I'm typing as part of title variable (the output like the photo down).

So is there any idea how to solve this? Am I doing it!

wrong?

The output

推荐答案

默认情况下,Laravel 5 {{ $title }}的构造将被转义.

如果不希望数据转义,可以使用以下语法:

{!! $title !!}

了解更多有关Blade 控制 struct 的信息:http://laravel.com/docs/5.0/templates#other-blade-control-structures

Laravel相关问答推荐

发送邮箱后,Laravel重定向偶尔会导致错误500

Laravel 模型事件:delete() 不会从存储中删除文件

如何在 Laravel 中使用 Vue 路由?

在 laravel 5.3 中截断的错误日志(log)

Laravel 5 将错误发送到Electron邮件

Lumen 中的自定义 404 页面

Carbon现在时间错了

laravel 基本路径

Laravel 5文件夹 struct 中的文件保存在哪里?

如何在 Laravel 中显示渲染时间/页面加载时间?

限制 Blade foreach 循环中的结果

如何判断是否在laravel中设置了cookie?

使用限制排队 Guzzle 请求

在表单中添加一对多 - Backpack laravel

如何在中间件 Laravel 中获取请求的控制器和操作的名称

如何在 Laravel 中实现数组类型路由?

Eloquent - 更新集合中的所有模型

Laravel 5.1-5.8 中以前的路由名称

如何在laravel 5.1中使用url(路由)传递多个参数

在 Laravel artisan 命令中使用详细