hello world hello world - 1 year ago 146
PHP Question

laravel blade template not rendering

Getting into laravel and im trying to work with blade templating but its not rendering. All my examples are coming for the laravel documentation.


So here is my master.blade.php file located in resources > views > master.blade.php

<!DOCTYPE html>

<div class="container">
<div class="content">
<div class="title">Test to Laravel 5</div>

and here is my header.blade.php file located in view/layouts/

<title>cookie monster</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
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;

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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download