duanqianpu6499 2018-07-06 10:06
浏览 57
已采纳

Laravel不包含文件

Hello i am new to laravel framework and i am learning this framework and i am using blade templating engine for the separating the code.i have creating 2 file like sidebar.blade.php and footer.blade.php and i have to call both the file in my index .php but it's not working. my file is in my-project/layout/sidebar.blade.php folder

here is my code: index.php

<body class="nav-md">
    <div class="container body">
      <div class="main_container">
        @include('layouts.sidebar')
       </div>
    </div>
</body>

sidebar.blade.php

  <!-- footer content -->
    <footer>
      <div class="pull-right">
        Gentelella - Bootstrap Admin Template by <a href="https://colorlib.com">Colorlib</a>
      </div>
      <div class="clearfix"></div>
    </footer>
    <!-- /footer content -->

file structure : enter image description here

enter image description here

result :

enter image description here

  • 写回答

5条回答 默认 最新

  • douwen5951 2018-07-06 10:39
    关注

    The resources directory contains your views as well as your raw, un-compiled assets such as LESS, SASS, or JavaScript. This directory also houses all of your language files.

    first you need to save all your view file with the extension of .blade.php Ex. 'yourfile-name.blade.php' and it must be in resources/views directory. If you want to add any new directory in that then you can add but when you include any file you have to specify the name of that directory like @include('your-folderName.bladeFileName');

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?