Laravel blade includes error - syntax error, unexpected

I am using Laravel 4 locally with EasyPHP 14.1. I created a route:

Route::get('/test', function()
{
    return View::make('test');
});

layout (testlayout.blade.php):

<!doctype html>
<html>
<head>
    <title></title>
</head>
<body>
    <div class="container">
        @yield('container')
    </div>
</body>
</html>

and view (test.blade.php):

@extends("testlayout")
@section('container')
    <h1>Hello!</h1>
@stop

It works great and I get "Hello!"

But when they change their layout by adding include, like this:

<!doctype html>
<html>
<head>
    <title></title>
</head>
<body>
    <div class="container">
        @yield('container')
    </div>
        @include('testfooter')
</body>
</html>

with my footer (testfooter.blade.php):

@section("testfooter")
    <div class="footer">2013-2014</div>
@show

I have a syntax error, unexpected '/' error.

The code generated by Laravel (found in app \ storage \ views) is incorrect:

<!doctype html>
<html>
<head>
    <title></title>
</head>
<body>
    <div class="container">
        <?php echo $__env->yieldContent('container')
    </div>
        <?php echo $__env->make('testfooter', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>; ?>
</body>
</html>

Laravel forgets ;?>after yieldContent('container')and adds two ;?>after ... render(). I have tried many things, but right now I have no clue.

Update1 I reinstalled the new Laravel and the guest, that the problem remains the same. Without @include, this is normal, with @include I have the same error over and over again.

UPDATE2 ( @majimboo)! . . : Notepad ++ Windows. somes "/ EOL/ Windows" "edit/EOL conversion/Mac format". , , Laravel Mac ! , Notepad ++ Windows, , : EOL/

+4
5

, .

, , , testfooter.blade.php, . , .

testfooter.blade.php :

<div class="footer">2013-2014</div>

@section("testfooter")... @show.

:

<!-- app/views/header.blade.php -->

<h1>When does the Narwhal bacon?</h1>

<!-- app/views/footer.blade.php -->

<small>Information provided based on research as of 3rd May '13.</small>

:

<!-- app/views/example.blade.php -->

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Narwhals</title>
</head>
<body>
    @include('header')
    <p>Why, the Narhwal surely bacons at midnight, my good sir!</p>
    @include('footer')
</body>
</html>

, .


, , - , , :

Notepad ++ - "MAC" End-Of-Line (EOL). -, Blade . ( ++: Edit → EOL Conversion) Windows, ...

Arjen

+3

:

@section("testfooter")
    <div class="footer">2013-2014</div>
@show // <--

:

@section("testfooter")
    <div class="footer">2013-2014</div>
@stop // <--
+1

Laravel . CSS JS. , laravel. .

  • Config/app → debug = true 16

')' css. Laravel FW , , .

, .

0

​​ PHP , Laravel. , .

0

, , , php , ,

<?php echo $__env->yieldContent('container'); ?>
</div>
    <?php echo $__env->make('testfooter', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
-1
source

Source: https://habr.com/ru/post/1536899/


All Articles