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条)

报告相同问题?

悬赏问题

  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图