Having trouble breaking my views up into something a little less redundant. Right now, this is how a typical layout looks:
master.blade.php:
<!DOCTYPE html>
<html>
<head>
<title>
@section('title')
@show
</title>
<script type="text/javascript" src="{{ asset('bower/jquery/dist/jquery.min.js') }}"></script>
<link href="{{ asset('bower/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
<script type="text/javascript" src="{{ asset('bower/bootstrap/dist/js/bootstrap.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bower/ckeditor/ckeditor.js') }}"></script>
<link href="{{ asset('css/default.css') }}" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row center-block text-center indexWrapper">
<div class="indexNav">
<ul class="text-right">
<li><a href="{{URL::to('people')}}">People</a></li>
<li><a href="{{URL::to('bulletin')}}">Bulletin</a></li>
<li><a href="{{URL::to('current')}}">Current</a></li>
<li><a href="{{URL::to('finished')}}">Finished</a></li>
</ul>
</div>
<div class="indexHeading">
<h1 class="indexH1">
@section('navTitle')
@show
</h1>
</div>
<div class="clearfix"></div>
</div>
@yield('content')
<div class="center-block login">
@yield('login')
</div>
</div>
<div class="row center-block footer">
<hr>
<ul>
<small>
<li><span style="color:red">DEVELOPMENT MODE</span></li>
<li>Mumble © 2014</li>
<li><a href="">Follow project on GitHub</a></li>
</small>
</ul>
</div>
@section('scripts')
@show
</body>
</html>
And then, extending that, are the individual pages views. I would like to separate the header and footer of the master layout though
What is the best way of doing efficient templating in blade?
Basic functionality is using an include, this will grab the file to include and put is't content in place of the include tag.
master.blade.php (placed under the 'views/' folder)
<!DOCTYPE html>
<html>
<head>
<title>
@section('title')
@show
</title>
@include('layout.header')
</head>
<body>
<div class="container">
<div class="row center-block text-center indexWrapper">
<div class="indexNav">
<ul class="text-right">
<li><a href="{{URL::to('people')}}">People</a></li>
<li><a href="{{URL::to('bulletin')}}">Bulletin</a></li>
<li><a href="{{URL::to('current')}}">Current</a></li>
<li><a href="{{URL::to('finished')}}">Finished</a></li>
</ul>
</div>
<div class="indexHeading">
<h1 class="indexH1">
@section('navTitle')
@show
</h1>
</div>
<div class="clearfix"></div>
</div>
@yield('content')
<div class="center-block login">
@yield('login')
</div>
</div>
<div class="row center-block footer">
<hr>
<ul>
<small>
<li><span style="color:red">DEVELOPMENT MODE</span></li>
<li>Mumble © 2014</li>
<li><a href="">Follow project on GitHub</a></li>
</small>
</ul>
</div>
@section('scripts')
@show
</body>
</html>
header.blade.php (placed under the 'views/layout/' folder)
<head>
<title>
@section('title')
@show
</title>
<script type="text/javascript" src="{{ asset('bower/jquery/dist/jquery.min.js') }}"></script>
<link href="{{ asset('bower/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
<script type="text/javascript" src="{{ asset('bower/bootstrap/dist/js/bootstrap.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bower/ckeditor/ckeditor.js') }}"></script>
<link href="{{ asset('css/default.css') }}" rel="stylesheet">
</head>
footer.blade.php Follow the same principle as the header for your footer.
Hope this helped!