ProjectsPlaza

Php Projects, Django Projects, Laravel Projects, Codeigniter Projects

Skip to content
  • My account
  • Cart
  • Forums
  • Sell
  • LICENSES
How-to-create-view-templates-in-laravel-5

How to create view templates in laravel 5

Hello world, welcome to my website. Today we will discuss how to create view templates in laravel 5. I have divided this article into the following parts.

  • Introduction of blade template engine
  • Create View Template
  • Extend template functionality


Introduction of blade template engine

Laravel comes with the powerful blade template engine. All the template files are stored in /resources/views folder. All blade files saved with .blade.php extension. There are number of template tags which can be used in the template. for example, @foreach, @if, @else, @php, @include, etc.


Create View Template

In this part, we will modify the welcome template.

  • Open welcome.blade.php file in /resources/views folder and replace with the following code.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Laravel Template</title>
</head>
<body>
    Welcome to this website
</body>
</html>
  • Now refresh the page, you will see the newly created template.

Extend template functionality

In this part, we will create common layout and extend this layout for other templates.

  • Create common.blade.php and add the following code into this file.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Laravel Template</title>
</head>
<body>
    @yield('content')
</body>
</html>
  • Open welcome.blade.php file and modify the code according to the following.
@extends('common')
@section('content')
<p>This is content</p>
@endsection

 


@yield tag help to load content into specified variable.
@section tag will send data to @yield tag.

This entry was posted in Laravel, Laravel 5, Php, Php Framework, Programming, Web Development and tagged how to create view templates in laravel 5, how to extend template in laravel, how to implement blade template in laravel, how to use blade template in laravel, how to use section in laravel, section tag in blade template, yield tag in blade template on September 17, 2019 by Projects Plaza.

Post navigation

← What is rate limiting in laravel 5 How to create view templates in flask →

More posts from this category

  • Create hello world app with fl...
  • Submit Form in Flask
  • Submit form and save data in d...
  • Implement pagination with code...
  • Update delete data from databa...
  • Upload image with codeigniter
  • Learn laravel with example
  • Create Hello World app with la...
  • Create todo app with laravel
  • Create Todo app with laravel &...
  • Upload Image in Laravel 5
  • Generate Dummy data in laravel...
  • Form validation in laravel
  • Add data in database in larave...
  • Create project from scratch wi...
  • Setup laravel 5 on local syste...
  • Create custom admin login with...
  • Create Read Update and delete...
  • Create a hello world app with...
  • Create a single page applicati...

Post Categories

  • Ajax
  • AngularJs
  • APIs
  • Codeigniter
  • Codeigniter Tutorial Series
  • Django
  • Django 3
  • Django Database
  • Django Frontend
  • Express
  • Flask
  • Handlebars
  • Jade
  • Javascript
  • Javascript Frameworks
  • Jquery
  • Laravel
  • Laravel 5
  • Laravel 7
  • Learn python with example
  • Matplotlib
  • Mobile Development
  • MongoDB
  • Mongoose
  • Nodejs
  • npm
  • Php
  • Php Framework
  • Programming
  • Python
  • Python Exercie
  • Python Web Framework
  • React Native
  • ReactJs
  • Uncategorized
  • Web Development
  • WordPress

Post Tags

  • codeigniter 3
  • codeigniter 3 from scratch
  • codeigniter 3 tutorials
  • Codeigniter Example Code
  • Codeigniter Tutorial
  • codeigniter tutorials
  • create project from scratch with django 2
  • django learning blog
  • django tutorials
  • how to create blog app with django
  • laravel 5 tutorials
  • laravel database
  • laravel practise example
  • laravel scripts
  • laravel turotials
  • Laravel tutorial
  • laravel tutorial blog
  • laravel tutorials
  • Laravel tutorial series
  • Learn Codeigniter
  • Learn Codeigniter From scratch
  • Learn Codeigniter with example
  • learn django
  • learn django 2
  • learn django framework
  • learn django from scratch
  • learn django with example
  • learn django with example code
  • learning codeigniter from scratch
  • learning codeigniterphp framework learning
  • learning laravel
  • learning php framework
  • learning php frameworks
  • learning python
  • Learn laravel
  • learn laravel 5
  • Learn laravel from scratch
  • Learn laravel with example
  • learn php
  • learn python 3
  • learn python with example
  • php framework tutorials
  • php scripts
  • projectsplaza
  • web development
Proudly powered by WordPress
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT
  • USD $
    USD dollar
  • INR ₹
    Indian Rupee
  • Projects
    • Ideas
    • Django
    • Laravel
    • Codeigniter
    • Core php
    • Bootstrap 4
  • Learn Php
    • Php
    • Laravel
    • Codeigniter
  • Learn Python
    • Python
    • Django
    • Flask
  • Javascript
    • Jquery
    • ReactJs
    • Ajax
    • AngularJs
    • React Native
  • Nodejs
    • Express
    • Jade
    • Handlebars
    • MongoDB