Getting into laravel and im trying to work with blade templating but its not rendering. All my examples are coming for the laravel documentation.
UPDATE
So here is my master.blade.php file located in resources > views > master.blade.php
<!DOCTYPE html>
<html>
<head>
@yield('layouts.header')
</head>
<body>
<div class="container">
<div class="content">
<div class="title">Test to Laravel 5</div>
</div>
</div>
</body>
</html>
and here is my header.blade.php file located in view/layouts/
@section('header')
<title>cookie monster</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 96px;
}
</style>
@endsection
when i try to render my page no styles are being added even tho i have inline css at the moment, because i'm just testing how blade template engine works.
You want to be using @include('layouts.header')
rather than @yield
.
@yield
is what you use on a master template to specify where content will go that you can then define on a child view.
@include
"allows you to easily include a Blade view from within an existing view." - https://laravel.com/docs/5.1/blade
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With