Ste*_*als 5 html php laravel-4
我的html代码是
<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>
Run Code Online (Sandbox Code Playgroud)
master.blade.php 是
<html>
<head>
@yield('title')
@yield('css')
@yield('js')
</head>
<body>
<div id="content">
<div id="container"></div>
<div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
menu.blade.php 是
<div id="menu"></div>
Run Code Online (Sandbox Code Playgroud)
sidebar.blade.php 是
<div id="sidebar"></div>
Run Code Online (Sandbox Code Playgroud)
footer.blade.php 是
<div id="footer"></div>
Run Code Online (Sandbox Code Playgroud)
我的视图文件是 home.blade.php
@extends('layouts.master')
@section('title')
<title>:: Login ::</title>
@stop
@section('js')
@stop
@extends('layouts.menu')
@extends('layouts.sidebar')
@extends('layouts.footer')
Run Code Online (Sandbox Code Playgroud)
路由器.php
Route::get('home', array('uses' => 'HomeController@home'));
Run Code Online (Sandbox Code Playgroud)
HomeController.php 是
public function home()
{
return View::make('home');
}
Run Code Online (Sandbox Code Playgroud)
我跑的id
localhost/project/public/index.php/home
Run Code Online (Sandbox Code Playgroud)
它只显示主刀片文件内容,y 侧边栏、页脚和菜单不显示,这是什么错误。
创建@including菜单布局:
<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>
Run Code Online (Sandbox Code Playgroud)
您的菜单:
<div id="menu">
<ul>
<li>
Item 1
</li>
<li>
Item 2
</li>
<li>
Item 3
</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
以及你的看法:
@extends('layouts.master')
@section('title')
:: Login ::
@stop
@section('content')
This is your content!
@stop
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9531 次 |
| 最近记录: |