Laravel blade 显示大括号和控件
Laravel blade showing curly brackets and controls
我的输出显示大括号和 Laravel 控件,如下例所示,但未打印值。
...
{{ $tb['ics'] }}
@if ($tb['scope'])
...
@endif @if(count($tb['icstostd']) > 0 )
@foreach ($tb['icstostd'] as $li) @endforeach
WIN Reference Title Status
{{ $li['win'] }} {{ $li['ref'] }} {{ $li['ref'] }} {{ $li['title'] }} {{ $li['title2'] }} {{ $li['status'] }}
@endif
我在应用程序的其他部分使用了这段代码,它运行良好,但现在只有在我使用 "<?= $variable ?>"
.
时才会打印变量
这是控制器代码。
return View::make('books.ics')->with('title',"Body Viewer")
->with('messages',$messages)
->with('searchResults',null)
->with('tb',$tb_array)
->with('tb_name',null);
这里是ics.blade.php
@extends('layout')
@section('header')
<link rel="stylesheet" type="text/css" href="/books/wi.css" />
@stop
@section('content')
@if (is_array($tb))
@include('books.partials.icsDisplay',array('tb'=>$tb))
@endif
@stop
这是 icsDisplay.php
的示例代码
<div id="icsDisplay" class="displayBox">
<div>
<div class="displayItem long">
<span class="label"> Title:</span>
<span class="value"> <?= $tb['title']?> </span>
</div>
<div class="displayItem long">
<span class="label">ICS Code:</span>
<span class="value">{{ $tb['ics'] }}</span>
</div>
@if ($tb['scope'])
<div class="displayItem long">
<span class="label">Scope:</span>
<span class="value"><?= $tb['scope'] ?></span>
</div>
@endif
@if(count($tb['icstostd']) > 0 )
<div class="eventBox longBox">
<h2>Books</h2>
<table>
<tr>
<th>WIN</th>
<th>Reference</th>
<th>Title</th>
<th></th>
<th>Status</th>
</tr>
<?php $evens = null ?>
@foreach ($tb['icstostd'] as $li)
<tr{{ $evens }}>
<td>{{ $li['win'] }} </td>
<td class="actionCol"><a href='/omailly/books/{{ $li['win'] }}'>{{ $li['ref'] }}</a></td>
<td>{{ $li['ref'] }} </td>
<td>{{ $li['title'] }} </td>
<td>{{ $li['title2'] }} </td>
<td>{{ $li['status'] }} </td>
</tr>
<?php if ($evens) {$evens = null;} else {$evens = " class='even'";} ?>
@endforeach
</table>
</div>
@endif
</div>
</div>
谁能帮我弄清楚为什么会这样?
始终将 .blade.php 添加到您使用 Blade 引擎的文件中。
尝试将您的 icsDisplay.php 重命名为 icsDisplay。blade.php。
我的输出显示大括号和 Laravel 控件,如下例所示,但未打印值。
...
{{ $tb['ics'] }}
@if ($tb['scope'])
...
@endif @if(count($tb['icstostd']) > 0 )
@foreach ($tb['icstostd'] as $li) @endforeach
WIN Reference Title Status
{{ $li['win'] }} {{ $li['ref'] }} {{ $li['ref'] }} {{ $li['title'] }} {{ $li['title2'] }} {{ $li['status'] }}
@endif
我在应用程序的其他部分使用了这段代码,它运行良好,但现在只有在我使用 "<?= $variable ?>"
.
这是控制器代码。
return View::make('books.ics')->with('title',"Body Viewer")
->with('messages',$messages)
->with('searchResults',null)
->with('tb',$tb_array)
->with('tb_name',null);
这里是ics.blade.php
@extends('layout')
@section('header')
<link rel="stylesheet" type="text/css" href="/books/wi.css" />
@stop
@section('content')
@if (is_array($tb))
@include('books.partials.icsDisplay',array('tb'=>$tb))
@endif
@stop
这是 icsDisplay.php
的示例代码<div id="icsDisplay" class="displayBox">
<div>
<div class="displayItem long">
<span class="label"> Title:</span>
<span class="value"> <?= $tb['title']?> </span>
</div>
<div class="displayItem long">
<span class="label">ICS Code:</span>
<span class="value">{{ $tb['ics'] }}</span>
</div>
@if ($tb['scope'])
<div class="displayItem long">
<span class="label">Scope:</span>
<span class="value"><?= $tb['scope'] ?></span>
</div>
@endif
@if(count($tb['icstostd']) > 0 )
<div class="eventBox longBox">
<h2>Books</h2>
<table>
<tr>
<th>WIN</th>
<th>Reference</th>
<th>Title</th>
<th></th>
<th>Status</th>
</tr>
<?php $evens = null ?>
@foreach ($tb['icstostd'] as $li)
<tr{{ $evens }}>
<td>{{ $li['win'] }} </td>
<td class="actionCol"><a href='/omailly/books/{{ $li['win'] }}'>{{ $li['ref'] }}</a></td>
<td>{{ $li['ref'] }} </td>
<td>{{ $li['title'] }} </td>
<td>{{ $li['title2'] }} </td>
<td>{{ $li['status'] }} </td>
</tr>
<?php if ($evens) {$evens = null;} else {$evens = " class='even'";} ?>
@endforeach
</table>
</div>
@endif
</div>
</div>
谁能帮我弄清楚为什么会这样?
始终将 .blade.php 添加到您使用 Blade 引擎的文件中。
尝试将您的 icsDisplay.php 重命名为 icsDisplay。blade.php。