Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel blade showing curly brackets and controls

My output is showing curly brackets and the Laravel controls as in the example below and the values are not being printed.

...
{{ $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

I've used this code in other parts of the application and it worked fine but now the variables will only print if I use "<?= $variable ?>".

Here is the controller code.

return View::make('books.ics')->with('title',"Body Viewer")
                                ->with('messages',$messages)
                                ->with('searchResults',null)
                                ->with('tb',$tb_array)
                                ->with('tb_name',null);

Here is 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

Here is the sample code for 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>

Can anyone help me to figure out why this is happening?

like image 401
Han Tan Avatar asked Dec 17 '25 11:12

Han Tan


1 Answers

Always add .blade.php to the files you are using the Blade engine with.

Try to rename your icsDisplay.php into icsDisplay.blade.php.

like image 111
Tim L Avatar answered Dec 20 '25 00:12

Tim L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!