You would usually do something like:
master.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>@yield('pageTitle') - App Name</title>
</head>
<body>
@yield('content')
</body>
</html>
formRegister.blade.php
@extends('layouts.master')
@section('pageTitle', 'Page Title')
@section('content')
<p>This is my body content.</p>
@stop
So your view extends your template which yields the sections defined in your view
Ok forget the content, it's just confusing. If I just want to set the page title, what should I change?
master.blade.php
<!DOCTYPE html> <html lang="en"> <head> <title>@yield('pageTitle') - App Name</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <body>formRegister.blade.php
@extends('master')
@section('pageTitle', 'Yabba dabba dope!')
I want the pageTitle to say Yabba dabba dope!
Oh w8. It kinda works. Thanks. As you said, I just had a typo with a weird stealthy exception
[x] solved
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community