Support the ongoing development of Laravel.io →
posted 8 years ago
Blade
Last updated 2 years ago.
0

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

Last updated 8 years ago.
0

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!

Last updated 8 years ago.
0

Oh w8. It kinda works. Thanks. As you said, I just had a typo with a weird stealthy exception

[x] solved

0

Sign in to participate in this thread!

Eventy

Your banner here too?

muppbarn muppbarn Joined 29 Mar 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.