Hello Laravel Friends,
Today we will learn about How to Create Blade Template Layout in Laravel.
The blade is a templating engine for the Laravel framework. Blade templating engine makes writing syntax easy and comfortable. Laravel Blade Template allows developers to create HTML-based smooth designs and themes. All the individual pages can extend the master template created with the blade template.
To create blade templates you just need to save your view file with the .blade.php extension rather than .php. Blade templates reside in the resources/views directory. Let’s find out How to Create Blade Template Layout in Laravel
Steps to Create Blade Template Layout in Laravel:
Step 1: Create a folder of your project name in the resources\views folder.
Step 2: Create layouts\partials folder in project_name folder
Step 3: Create header.blade.php, footer.blade.php and script/stylesheet.blade.php as per the requirement at the below path
Step 4: Create mainlayout.blade.php in the below path
And add the following code to add header, footer, script, and stylesheet file
<title>Project Name </title>
@include('project_name.layouts.partials.stylesheet')//include stylesheet file
@yield('styles') // for page specific stylesheet
@include('project_name.layouts.partials.script') // include script file
@include('project_name.layouts.partials.header') // include header file
@yield('content') //content part of page
@include('project_name.layouts.partials.footer') // include footer file
@yield('scripts') // for page specific script
Step 5: Include the mainlayout file as per your requirement and add sections.
//page specific style
// write your page content here
// code for page specific script
This way you can Create Blade Template Layout in Laravel. If you face any difficulty reach me via the comment box and Hire Dedicated Laravel Developers for your custom requirement. Stay tuned for the upcoming Laravel solutions.