1

I have the following code snippet to end a file in php and laravel.

 @extends('master')
 @section('content')
   <p>Hello World</p>  
 @endsection

master.blade.php file is as below

<!doctype html>
<html lang="em">
  <head>
   <meta charset="UTF-8">
   <title>{{ $title }}</title>
    {{ HTML::style('css/bootstrap.css') }}
    {{ HTML::script('js/bootstrap.js') }}
    {{ HTML::script('js/jquery.js') }}

 </head>
 <body>
 <div class="navbar">
    <div class="navbar-inner">
      {{ HTML::link('/','login',array('class' => 'brand')) }}
      <ul class="nav pull-right">
        @if(Auth::user())
         <li>{{ HTML::link('logout', 'Logout') }}</li>
        @else 
        <li>{{ HTML::link('login','login') }}</li>
     </ul>
    </div>
 </div>
<div class="container">

    @yield('content')
</div>

However, I get the following error:

FatalErrorException in 4d94a10943d3d038e850b4e898e794a8 line 33:
syntax error, unexpected end of file

What exactly is the syntax to end the file in laravel,php using the blade template.

1 Answer 1

3

You're missing the @endif directive. Your blade syntax needs to be:

@if(Auth::user())
    <li>{{ HTML::link('logout', 'Logout') }}</li>
@else 
    <li>{{ HTML::link('login','login') }}</li>
@endif

Without the @endif directive, you'll get the "unexpected end of file" error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.