Hello Laravel community,
I am new to Laravel and trying to get my foot in the door. It is proving to be a more challenging task than I initially expected. I am trying to create some sort of "template" system using routes and views, but nothing shows up.
routes.php
Route::get('/', function()
{
return View::make('master');
});
The following is in the views folder:
master.blade.php
<html>
<head></head>
<body>
@yield('layout.header')
@yield('content')
@yield('layout.footer')
</body>
</html>
home.blade.php
@extends('master')
@section('content')
This is a test
@stop
layout/header.blade.php
@extends('master')
@section('header')
Testing the header
@stop
layout/footer.blade.php
@extends('master')
@section('footer')
Testing the footer
@stop
try return View::make('home');
instead of 'master'
That got me somewhere, but the header and footer do not show up. And, I tried using @include to get the header to show up and it gives me 502 bad gateway on nginx.
Hello there again, please do not use ... @yield('layout.header') @yield('layout.footer') ...
instead try using
<html>
<head></head>
<body>
@include('layout.header')
@yield('content')
@include('layout.footer')
</body>
</html>
and remove from both footer and header first line ( @extends('master')
)
Have fun
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community