Tuesday, February 28, 2017

Reuse template in laravel

Tags



  
 In order to reduce development time, most people will tend to reuse the interface from other template. It not only reduce workload, but also shorten the time for debugging and less code used.

This tutorial will teach you on how to reuse template from another template.

I will be using blade file called "parent.blade.php" and "child.blade.php" for easier understanding.

I need to use interface in parent into child.So all i do is that i use blade function called @section.
Section allow us to rename the part that we need for reuse purpose.

parent.blade.php



child.blade.php



By doing based on the code, you should be able to get section(naruto) from parent template.
For more reference, you can visit laravel official website for more info. Blade Template

It easy, just like basic html. Open and close the section where you want it. And reuse it on other template. Huge thanks to laravel for providing such feature to us!

If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page


EmoticonEmoticon