[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 ')