The view in the Laravel reference document is a little easier to explain.
The flexibility of view in real-world project development is actually very large.
Let's start by looking at the difference between layout pages in Laravel and ASP.
<! DOCTYPE html>
<!--this is equivalent to a @section (' title ', false) in ASP.
@section (' title ') <title>{{{$title}}}</title> <!--using {{$title}} is bad here eg:</title>< Script>alert (' hello ') </script>-
<!--here {{{}}} differs from {{}} by transcoding, which does not transcode--@show <meta content= ' Width=device-width, initial-scale=1, MAXIMUM-SC ale=1, User-scalable=no ' name= ' viewport ' > {{html::style (' Vendor/bootstrap/dist/css/bootstrap.css ')}} @section (' Style ') @show <!--HTML5 Shim and respond.js IE8 support of HTML5 elements and media queries-<!--WA RNING:Respond.js doesn ' t work if you view the page via file://-<!--[if Lt IE 9]> <script Src= "Https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" ></script> <script src= "https://oss.ma Xcdn.com/libs/respond.js/1.3.0/respond.min.js "></script> <! [endif]--> @include (' Shared.header ') <div class= "Container" > {{$main}} </div><!--./wrapper --{{html::script (' Vendor/jquery/dist/jquery.js ')}} {{html::script (' vendor/bootstrap/dist/js/bootstrap.js ')} } @section (' script ') @show </body> Look at the Post.home code of the home page display list:
<div class= "Row" > <div class= "col-xs-12 col-sm-6 col-md-8" > {{$content}} </div> <div class= "Col-xs-6 col-md-4" >
<!--This part of the view is a global reference, the view synth in the previous chapter of route.php-- @include (' Shared.sidebar ') </div>< /div>
There is also post.index code Post.index back as a child view will replace {{$content}} in Post.home
@if (!empty ($notFound)) <p>sorry nothing found for your query!</p> @else @foreach ($posts as $post) <article Class= "POST" >
Laravel Frame View This section has many other components, and this chapter code does not refer to other components.
The simple demo is complete and the following is the complete code.
Http://pan.baidu.com/s/1ntzDsyH
Next, we will look at some of the components commonly used in laravel and apply them to the demo project.
. NET to PHP laraval Framework Learning Series (iv) Project combat---View