如何在另一个文件中包含刀片tempate?

时间:2017-02-23 18:31:14

标签: laravel laravel-5.4

我有两个傻瓜:

<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
          <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
           <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
           <style type="text/css">
            
           </style>
           </head>
           <body>
            <div class="container content-md">
          
            <div class="col-md-offset-2 col-md-8 col-sm-8 col-sm-offset-2">
        <p class="text-center margin-bottom-20"><strong>You must accept the terms of usage of this website before you can continue. Click on the "I Agree" button to continue or the "I Do Not Agree" button to close this window.</strong></p>
      </div>
            
          <div class="row margin-bottom-100">
        <div class="col-md-offset-2 col-md-8 col-sm-8 col-sm-offset-2">
          <div class="service-block service-block-u">
            <p>Under F.S. 668.6076, e-mail addresses are public records. If you do not want your e-mail address released in response to a public-records request, do not send electronic mail to this entity. Instead, contact this office by phone or in writing. The accuracy of the information provided on this website is not guaranteed for legal purposes. Changes occur daily to the content. To obtain the most current information, please contact the Manatee County Tax Collector's office. All online payment transactions are final, and cannot be reversed, cancelled, post-dated or refunded. Copyright ©2002-2016 Manatee County Tax Collector's Office. All rights reserved</p>
            <button type="button" class="btn btn-default">I Agree</button>&nbsp;&nbsp;&nbsp;
                        <button type="button" class="btn btn-default">I Do Not Agree</button>
                    </div>
        </div>
      </div>
            
            <div class="col-md-offset-2 col-md-8 col-sm-8 col-sm-offset-2">
        <p class="text-center"><strong>THIS INFORMATION IS BELIEVED TO BE CORRECT BUT IS SUBJECT TO CHANGE AND NOT WARRANTED</strong></p>
      </div>
        </div>
    <!--=== End Content ===-->
  </body>
  </html>

阻止landing.blade.php

如何在comments.blade.php内添加comments.blade.php?

3 个答案:

答案 0 :(得分:2)

您可以通过以下语法将一个刀片模板包含到其他模板中:

包括子视图

@include('view.name')

您也可以将数据数组传递给包含的视图:

@include('view.name', array('some'=>'data'))

有关详细信息,请访问:

https://laravel.com/docs/5.0/templates

由于

答案 1 :(得分:1)

According to the documentation您需要@include

landing.blade.php:

<div>
    Some content

    @include('comments', ['comments' => $comments])
</div>

答案 2 :(得分:1)

简单的方法,

如果landing.blade.phpcomments.blade.php位于同一目录中,请假设它们都在ressource/view

所以在landing.blade.php上你可以写@include('comments')