search

Home  >  Q&A  >  body text

Blade - How to use template layout in laravel? Specific examples, especially how to use @section, @stop, @show, @yield?

I am a novice, but I just can’t understand the templates in Laravel and don’t use them very much. I don’t understand the examples on the official website. I hope friends who have learned it can give specific examples; especially @section, @stop, @show, @yield How to use these?
Then how to inherit?

巴扎黑巴扎黑2750 days ago466

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 16:55:33

    yield is equivalent to defining a placeholder space in the parent. For example, if you name it a, you write a section and endsection in the child. The parameter is a, and then write the style code in it. When accessing the parent, the code segment in the child is inserted into This place of the Father. In the parent, you can write tags starting with section and ending with show, which means that code in the child page is allowed to be appended here. The actual result is very similar to the result of using yield with section, but the semantics are different. Personal opinion

    reply
    0
  • Cancelreply