Laravel Template Tutorial – How To Integrate Any Bootstrap Template

0
363
laravel template

Follow my blog with Bloglovin

Laravel is an open-source PHP framework. It is a popular framework for PHP developers and web development companies. It provides the variety of features for a fast-paced development environment for building web applications. The current version of laravel is 5.5. Laravel has its own templating engine called as Blade. This tutorial focusses on how to use any Bootstrap/HTML template in laravel using blade laravel template.

Views Structure in Laravel

laraval template
laraval template

As displayed in the picture(above) there is a views folder in resources folder which comes by default in the laravel framework where all view files mean front-end files are created for example login, registration, profile pages, etc. So, we will create a template folder here in views folder for storing common files used in the template.

Important Steps:

laraval template

Copy css, js, images, plugins folders into the respective css, js, images, plugins folders in public folder of laravel framework. Note: if plugins, images folders are not existed then create and add files to it.

Once you have complete above step, now, it’s time to create blade template files in template folder to use this bootstrap theme.

Create head.blade.php, menu.blade.php, sidebar.blade.php, footer.blade.php files in template folder. Note: Copy below from index.html file of template.

head.blade.php => Copy code between <head></head> html tags of template and save

menu.blade.php => Copy code between <nav></nav> html tags of template and save

sidebar.blade.php => Copy code between <aside></aside> or “leftbar” html tags of template and save

footer.blade.php => Copy code between <footer></footer> html tags as well as scripts links of template and save

Now, Create template.blade.php(below) file. Here, We will use two methods for templating. First, to include portions of index.html in this template file and second is used to create pages like login, tables, registration, etc.,

Most Important Point is we need to insert “@yield(‘content’)” in content section above template, it means whatever page we will create will be presented here and create entire page for it. So, it’s blade templating engine mechanism we have to follow.

Now, you can create any page outside template folder but inside views folder and use this entire structure which we created above. For example, I want to create a profile page, create profile.blade.php(below) in view folder.

Finally, this is the simplest way to use admin template/ bootstrap template/ HTML templates in laravel template using blade template.

Please subscribe to get a more exciting tutorial to learn.

 

LEAVE A REPLY