Professional Documents
Culture Documents
Giới thiệu
Để download Template bạn vào địa chỉ Link download tải về, sau giải nén,
bạn sẽ có đầy đủ các thư mục như css, js, images như sau:
Lưu ý: tất cả các file bắt buộc phải có đuôi mở rộng là .blade.php
Tiếp theo các bạn cũng có thể tách các phần trên layout ra thành từng
phần khác nhau như #top, #slide, #sidebar, #footer ra các file tương
ứng để cho dễ quản lý, sau đó có thể include vào layout chính của
chúng ta, để làm được điều này Laravel cung cấp cho chúng ta một
tag là @include
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title> @yield('title')</title>
</head><!--/head-->
GV:Ngô Lê Quân 4
<body>
<!--/header-->
@include("elements.top")
<!--/slider-->
@include("elements.slide")
<section>
<div class="container">
<div class="row">
<div class="col-sm-3">
@include("elements.sidebar")
</div>
@yield('content')
</div>
</div>
</div>
</section>
@include("layouts.elements.footer")
<!--/Footer-->
</body>
</html>
@extends('layout')
@section('content')
Đoạn code từ
<div class="features_items"><!--features_items-->
Đến
</div><!--/recommended_items-->
@endsection
GV:Ngô Lê Quân 6
product.blade.php
@extends('layout')
@section('content')
@endsection
news.blade.php
@extends('layouts')
@section('content')
@endsection
Route::get('/product', function () {
return view('pages.home');
});
Route::get('/product', function () {
return view('pages.product');
});
Route::get('/news', function () {
return view('pages.news');
});
Route::get('/contact', function () {
return view('pages.contact');
});
Bước 6.
Tạo top.blade.php
<header id="header"><!--header-->
Đoạn code trong file index.html
</header><!--/header-->
Tạo footer.blade.php
<footer id="footer"><!--Footer-->
Đoạn code trong file index.html
</footer><!--/Footer-->
</div>
@endsection