Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 Blade BUG

Having trouble getting blade template to work... all that is displayed on the page is:

@extends('layouts.admin')

Here is the route:

Route::get('login', function(){ 
    return View::make('admin.login');
});

Here is the template: layouts/admin.blade.php

<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width" />
</head>
<body>
<div class="large-12 columns">
  <div id="wrap" class="large-8 large-centered columns"> 
    @yield('content') 
  </div>
</div>
</body>
</html>

And here is the view: views/admin/login.blade.php (no breaks or space before @extends)

@extends('layouts.admin')
@section('content')
<h1>Admin Login</h1>
...
@stop

Any help appreciated!

like image 938
suncoastkid Avatar asked Mar 25 '26 00:03

suncoastkid


2 Answers

I don't see any errors in your code, it works fine for me and more people here. So you might have problems in some other part of your code that you're not showing to us.

I just made this git repository reproducing the code you posted here.

It may prove to you that Laravel works and sometimes the problem is just elsewhere. Or it may prove to us that in some environments Laravel is broken, wich might help the project.

So, please, give it a try and tell us what you get going to the route http://your-host/login.

like image 142
Antonio Carlos Ribeiro Avatar answered Mar 26 '26 13:03

Antonio Carlos Ribeiro


This wasted hours of my life. There was nothing in the code that was wrong and I would still possibly consider this a bug since no errors were generated. I finally ended up creating NEW files with the EXACT same code and replacing the existing blade files and suddenly it magically works. I'm not sure if somehow the files were corrupted or what but hopefully this will save somebody hours of frustration.

like image 30
suncoastkid Avatar answered Mar 26 '26 13:03

suncoastkid



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!