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

Maybe is cause you are calling it in the same template ?

Make a new blade and extend it from there then call the section.

app.blade:

      @yield('carometers')

another.blade:

    @extends('app.blade')

    @section('carometers')

         content

   @endsection
0

Thanks for answering.

Sorry, I ended up messing up the code when posting. My code is the same as what you wrote.

The folder structure looks like this: views / frontend / layout / app.blade.php

In app.blade.php is the header and footer. In this screen I have: (@yield ('carometers'))

In the carometro view I have:

@extends ('frontend.layout.app') @section ('carometers') ... @endsection

On screen only loads the header and footer. The section does not load.

0

I was able to show using @include. But I still can't understand why @include works and @yield doesn't work. I am developing a website and I am placing each section on a separate blade and on the main page I am calling @yield several times.

0

Have you added the directive

     @parent

As in

     @section('x)
      @parent
            Content
      @endsection

Also check this out it will help you.

        https://laravel.com/docs/6.x/blade
0

Thanks again for the help, but it didn't work out. I do not know what happens. I looked at the documentation and did the same, but it doesn't work.

0

Good night, I could understand and see where I was going wrong. Thanks a lot for the help.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.