How to create a separate blade for the menu, contents, sidebar and footer
my html code
<html>
<head>
</head>
<body>
<div id="content">
<div id="menu"></div>
<div id="container"></div>
<div id="sidebar"></div>
<div id="footer"></div>
<div>
</body>
</html>
master.blade.php
<html>
<head>
@yield('title')
@yield('css')
@yield('js')
</head>
<body>
<div id="content">
<div id="container"></div>
<div>
</body>
</html>
menu.blade.php
<div id="menu"></div>
sidebar.blade.php
<div id="sidebar"></div>
footer.blade.php
<div id="footer"></div>
my file is of the form home.blade.php
@extends('layouts.master')
@section('title')
<title>:: Login ::</title>
@stop
@section('js')
@stop
@extends('layouts.menu')
@extends('layouts.sidebar')
@extends('layouts.footer')
router.php
Route::get('home', array('uses' => 'HomeController@home'));
HomeController.php
public function home()
{
return View::make('home');
}
id i run
localhost/project/public/index.php/home
only the contents of the main blade file are displayed, y the sidebar, footer and menu are not displayed, which is an error.
+3
1 answer
Create your layout @includingin your menu:
<html>
<head>
<title>@yield('title')</title>
@yield('css')
@yield('js')
</head>
<body>
<div id="content">
<div id="container">
@include('menu')
@yield('content')
</div>
</body>
</html>
Your menu:
<div id="menu">
<ul>
<li>
Item 1
</li>
<li>
Item 2
</li>
<li>
Item 3
</li>
</ul>
</div>
And your opinion:
@extends('layouts.master')
@section('title')
:: Login ::
@stop
@section('content')
This is your content!
@stop
+4