Laravel Blade Layouts Folder Structure

Today, We want to share with you Laravel Blade Layouts Folder Structure.In this post we will show you Simple Laravel Layouts using Blade Template, hear for Create Layout Using Laravel Blade Templating Engine we will give you demo and example for implement.In this post, we will learn about Laravel Layouts Folder Structure Using Blade with an example.

Laravel Blade Layouts Folder Structure

There are the Following The simple About Laravel Blade Layouts Folder Structure Full Information With Example and source code.

As I will cover this Post with live Working example to develop Larave 5.8 Blade Layout with Example, so the laravel blade template bootstrap Directory structures for this example is following below.

Read Also:  Laravel create Dynamic Email Templates from Database

Step 1: Laravel Routing

Route::get('/', function()
{
    return View::make('shops.home');
});
Route::get('sitemap', function()
{
    return View::make('shops.sitemap');
});
Route::get('Products', function()
{
    return View::make('shops.Products');
});
Route::get('privacy', function()
{
    return View::make('shops.privacy');
});

Step 2: Views

The Laravel File Structure

- app
-- views
--- layouts
------- default.blade.php
------- category.blade.php
--- shops
------- home.blade.php
------- sitemap.blade.php
------- Products.blade.php
------- privacy.blade.php
--- includes
------- head.blade.php
------- header.blade.php
------- footer.blade.php
------- category.blade.php


Step 3: Includes

head.blade.php

<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="Scotch">

<title>Welcome To Pakainfo.com</title>

<!-- imple load bootstrap from a cdn Live-->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/3.0.3/css/bootstrap-combined.min.css">


header.blade.php

<div class="navbar">
    <div class="navbar-inner">
        <a id="logo" href="/">Pakainfo</a>
        <ul class="nav">
            <li><a href="/">Home</a></li>
            <li><a href="/sitemap">Sitemap</a></li>
            <li><a href="/Products">Products</a></li>
            <li><a href="/privacy">Privacy</a></li>
        </ul>
    </div>
</div>

footer.blade.php

<div id="copyright text-right">© Copyright 2013 Jaydeep Gondaliya (Pakainfo.com)</div>

Step 4: Default Layout and Pages (Home, Privacy)

<!doctype html>
<html>
<head>
    @include('includes.head')
</head>
<body>
<div class="container">

    <header class="row">
        @include('includes.header')
    </header>

    <div id="main" class="row">

            @yield('content')

    </div>

    <footer class="row">
        @include('includes.footer')
    </footer>

</div>
</body>
</html>


Step 5: Home Page and Privacy Page

shops/home.blade.php

@extends('layouts.default')
@section('content')
    We are the home page
@stop

shops/privacy.blade.php

@extends('layouts.default')
@section('content')
    We are the privacy page
@stop


Step 6: Sidebar Layout and Pages

Sidebar Include

includes/category.blade.php

    <!-- category nav -->
    <nav id="category-nav">
        <ul class="nav nav-pills nav-stacked">
            <li><a href="#">Mobile</a></li>
            <li><a href="#">Laptop</a></li>
            <li><a href="#">Iphone</a></li>
        </ul>
    </nav>
	

Sidebar Layout

layouts/category.blade.php

<!doctype html>
<html>
<head>
    @include('includes.head')
</head>
<body>
<div class="container">

    <header class="row">
        @include('includes.header')
    </header>

    <div id="main" class="row">

        <!-- category content -->
        <div id="category" class="col-md-4">
            @include('includes.category')
        </div>

        <!-- main content -->
        <div id="content" class="col-md-8">
            @yield('content')
        </div>

    </div>

    <footer class="row">
        @include('includes.footer')
    </footer>

</div>
</body>
</html>


Step 7: Sitemap and Products Pages

shops/sitemap.blade.php

@extends('layouts.category')
@section('content')
    We are the sitemap page
@stop


shops/Products.blade.php

@extends('layouts.category')
@section('content')
    We are the Products page
@stop

Web Programming Tutorials Example with Demo

Read :

Read Also:  Multiple WHERE conditions in Laravel Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel Blade Layouts Folder Structure.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Create Contact Form And Send Email using PHP
  2. Read Also:  WordPress Plugin Redirect After Activation
  3. Read Also:  How to write PHP code inside of Laravel Blade template?
  4. Read Also:  Magento 2 How to solve one or more indexers with Reindexing using Command
  5. Read Also:  How to Write PHP Code in Laravel Blade?
  6. Read Also:  WooCommerce Get Product Taxonomies
  7. Read Also:  Number Expressions using Angular Example
  8. Read Also:  Laravel 5.6 Admin Panel Example Tutorial From Scratch
  9. Read Also:  Vue Instant Search Example Demo
  10. Read Also:  Laravel 5.7 Bootstrap Admin Panel Templates Integrate