返回头尾分离模板继......登陆

头尾分离模板继承

JasonKim2019-05-16 08:09:43258
// base.blade.php  基础模板
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
 content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>布局模板</title>
    <style>
        .header,.footer{width: 100%;height: 60px;background: skyblue;text-align: center;line-height: 60px;}

        .main{overflow: hidden;min-height: 600px;width: 90%;margin: 5px auto;}

        .main .sider{
            float: left;
            width: 30%;
            min-height: inherit;
            background: lightgreen;
        }

        .main .content{
            float: right;
            width: 70%;
            min-height: inherit;
            background: wheat;
        }

    </style>

</head>
<body>

    <div class="header">
        @section('nav')
 <a href="#">首页</a>
            <a href="#">公司新闻</a>
            <a href="#">快捷资讯</a>
            @show
 </div>

    <div class="main">
        <div class="sider">
            @yield('ads','广告招商:13388669988')
 </div>
        <div class="content">
            @section('content')
 <h2>网站上线通知</h2>
                <p>新网站更新内容,快乐体验吧!</p>
                @show
 </div>
    </div>

    <div class="footer">
        @section('footer')
 php.cn版权所有
 @show
 </div>


</body>
</html>

// 视图模板,继承base.blade.php
{{-- 继承模板 --}}
@extends('home.base')

@section('nav')
    @parent
    <a href="#">加入我们</a>
    <a href="#">关于我们</a>
@stop

@include('home.inc.abs')

@section('content')
    {{-- 继承 --}}
    @parent
    <h1>更多新功能等你使用哦</h1>
@stop


@section('footer')
    @parent
    <a href="#">粤ICP备案号:20190516</a>
@stop


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送