如何解决在 Laravel 中包含布局
<body>
@include('layouts.header')
@yield('content')
@include('layouts.footer')
@include('layouts.footer-script')
</body>
@extends('layouts.master')
// I would like to add Menu here
@section('content')
//more code here
@endsection
我的 menu.blade.PHP
如下所示。
@extends('dashboard')
@section('menu')
// more HTML code
@endsection
如何在 Menu
中添加 dashboard.blade.PHP
?
解决方法
dashboard.blade.php
文件如下
@extends('layouts.master')
@include('menu')
@section('content')
//more code here
@endsection
menu.blade.php
如下所示。
<div>
// more HTML code
</div>
,
如果您的菜单是静态的,只需将其用作包含
仪表盘文件
@extends('layouts.master')
@section('content')
@include('layouts.menu')
@endsection
和菜单文件将是 (menu.blade.php)
<a href=''>Home</a>
,
master.blade.php
<body>
@include('layouts.header')
@yield('content')
@include('layouts.footer')
@include('layouts.footer-script')
</body>
dashboard.blade.php
@extends('layouts.master')
@include('menu')
@section('content')
//more code here
@endsection
这是您的代码。 这很好。 如果这是错误,我认为menu.blade.php的路径一定是错误的。
例如:@include(frontend.menu)
感谢您的回答。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。