刀片布局无法在laravel刀片中正确显示(渲染)

时间:2015-01-19 18:03:22

标签: php laravel layout laravel-4 blade

这是我的布局刀片代码

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Smart Bus</title>
<!-- css section start -->
 {{ HTML::style('assets/css/style.css') }}
<!-- js section start -->
</head>
<body>
<div class="main-total-container">
    <div class="main-content-container home-main-container">              <!-- main content container start -->
          <div class="login-tot-container">   <!-- login panel start -->
               @yield('body')    
               <div class="shodow_box">
               </div>
          </div>                          
    </div>                                
</div>
</body>
</html>

以下是主页的代码:

@extends('layouts.loginlayout')
@section('body')
<div class="login-panel">
                    <div class="logo-login">
                         <img src="assets/images/logo.png" alt="MashaTaxi"/>
                    </div>
                    <div class="welcome-panel">
                       <h3>Welcome Masha Taxi</h3>
                    </div>
                    <div class="log-head-panel">
                       <h3>Login</h3>
                    </div>
                    <form action="#" method="post" enctype="multipart/form-data">
                     <ul>
                         <li><span class="icon username-icon"></span><input type="text" placeholder="Username" /></li>
                         <li><span class="icon password-icon"></span><input type="password" placeholder="Password" /></li>

                         <li>
                             <input type="submit" value="Submit"/>
                         </li>
                          <li>
                             <a href="#" class="forgot_btn gen_btn">Forgot password</a>
                         </li>
                      </ul>
                    </form>
</div>

但每当我用来看薪水时,它的刀片就会显得错误。我的意思是它没有正确渲染。

因此,当我看到页面源时,它显示如下

<div class="login-panel">
                    <div class="logo-login">
                         <img src="assets/images/logo.png" alt="MashaTaxi"/>
                    </div>
                    <div class="welcome-panel">
                       <h3>Welcome Masha Taxi</h3>
                    </div>
                    <div class="log-head-panel">
                       <h3>Login</h3>
                    </div>
                    <form action="#" method="post" enctype="multipart/form-data">
                     <ul>
                         <li><span class="icon username-icon"></span><input type="text" placeholder="Username" /></li>
                         <li><span class="icon password-icon"></span><input type="password" placeholder="Password" /></li>

                         <li>
                             <input type="submit" value="Submit"/>
                         </li>
                          <li>
                             <a href="#" class="forgot_btn gen_btn">Forgot password</a>
                         </li>
                      </ul>
                    </form>
</div>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Smart Bus</title>
<!-- css section start -->
 <link media="all" type="text/css" rel="stylesheet" href="http://localhost/masnataxi/assets/css/style.css">

<!-- js section start -->
</head>
<body>
<div class="main-total-container">
    <div class="main-content-container home-main-container">              <!-- main content container start -->
          <div class="login-tot-container">   <!-- login panel start -->

               <div class="shodow_box">
               </div>
          </div>                          
    </div>                                
</div>
</body>
</html>

使用刀片布局时我在做什么错误

我正在使用

@extends('layouts.loginlayout')
@section('body')

以正确的方式我@yield('body')处于正确的位置。

我正在做的错误是什么?如何解决这个问题?

更新:

为了更好地理解

首先显示HTML标记,然后显示正文,然后HTML结束

1 个答案:

答案 0 :(得分:1)

您忘了@stop @section('body')