Reputation: 153
I've the main file which is welcome.blade.php
where I've mark up something like this
<!DOCTYPE html>
<html>
<head>
<title>
@yield('title') // title from signup.blade.php
</title>
</head>
<body>
<!-- some content here -->
@yield('signup') // I'm loading this from signup.blade.php
<!-- some content here -->
</body>
</html>
I'm loading sign up page
from signup.blade.php
which is in directory layouts/signup.blade.php
.
signup.blade.php
page has code something like this:
@include('welcome')
@section('title')
measurement
@endsection
@section('signup')
<div class="container">
<div class="row">
<div class="col-md-6">
<form action="">
<input type="text" class="form-control">
</form>
</div>
</div>
</div>
@endsection
The structure of the files is like this :
resources/views/welcome.blade.php
resources/views/layouts/signup.blade.php
But the problem is neither the title
is showing when I load welcome.blade.php
neither the sign up form
appears.
Note: The title is showing localhost:8000
, don't know why ?
Am I doing anything wrong, please help me thanks.
Upvotes: 1
Views: 155
Reputation: 6233
Your master template welcome.blade.php
<!DOCTYPE html>
<html>
<head>
<title>
@yield('title')
</title>
</head>
<body>
@yield('content')
</body>
</html>
And now any page that will use this template need to extends it. In your case signup.blade.php
@extends('welcome')
@section('title')
measurement
@endsection
@section('content')
<div class="container">
<div class="row">
<div class="col-md-6">
<form action="">
<input type="text" class="form-control">
</form>
</div>
</div>
</div>
@endsection
Upvotes: 2