[Laravel5.1-0.0.3] [basic 2] Blade template inheritance

Source: Internet
Author: User
[Laravel5.1-0.0.3] [basic 2] Blade template inheritance

My original address: http://www.jianshu.com/p/0aa1153eac22
What is the use of template inheritance? Naturally, it enhances the reuse of basic pages, facilitates the organization of page documents, and facilitates the change of content used in multiple places, such as the page header and footer.

1. usage overview
  • @ Include ('Common. head') contains the subview

  • @ Extends ('article. common. base') inherits the basic template

  • @ Yield ('content') placeholder for the view

  • @ Section ('content') @ endsection inherits the template and then fills in the content in the view placeholder.

  • {-- Comment --} use of the comment in the Blade Template

2. use section 2.1 to create the basic Article template base. blade. php.

Directly use the Bootstrap4 template code and CDN to create a basic view template
Path resources/views/article/common/base. blade. php

    Artilce | title here    
     
     
     
 {-- Include page header --} @ include ('article. common. header ') {-- inherit the inserted content --} @ yield ('content') {-- include footer --} @ include ('article. common. footer ')

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.