


Blade template engine-common grammar formats Three Kingdoms blade textblade superblade
Print variables or default values. This syntax will automatically escape the html tags in the variable content, causing the html tags to be output as they are.
Welcome, {{ $name or 'California' }}
Print the original content of the variable , usage without escaping
{!! 'My list <script>alert("spam spam spam!")</script>' !!}
-
Loop
@if (count($lists) > 1)
Normal loop@foreach ($lists as $list)
<li>{{ $list }}</li>
@endforeach
Handle the case when the variable is empty@forelse ($lists as $list)
<li>{{ $list }}</li>
@empty
<li>You don't have any lists saved.
if judgment
-
@elseif ()
@yield('content')@else
@endif
Use the following syntax in the template to create content Placeholder
-
@extends('layouts.master')Use the template in the view using the following syntax
-
@section('content')Use the following syntax to populate the placeholder content
-
content
@include('partial')@endsection
Use the following syntax to reference sub-php files
-
@include('partials.row', ['link' => $link])
@section('advertisement')
, pass parameters to sub-filesHow to decide whether to use some public content in sub-views
-
parent content
@show
The advertising section defined by the above syntax will not be displayed directly in the subview. @show is equivalent to @endsection @yield('advertisement')
@section('advertisement')
@parentchild content
@endsection
Only if @parent is used here, the content defined in the advertisement in the template will be displayed in the subview
10. Syntax for referencing css, js, etc. in the template{!! HTML::style('css/app.min.css') !!}
{!! HTML::script('javascript/jquery-1.10.1.min.js') !!}{ !! HTML::script('javascript/bootstrap.min.js') !!}
{!! HTML::image('images/logo.png', 'TODOParrot logo') !!}
here It should be noted that if you write a standard html tag, you need to add a '/' symbol in front of the path
To use the above syntax, you need to install the HTML package
11. Install the HTML packagecomposer require illuminate/html
Configure provider and alias in config/app.php
IlluminateHtmlHtmlServiceProvider::classprovider configuration
'Form ' => IlluminateHtmlFormFacade::class,
Facade configuration
The above introduces the Blade template engine - common syntax formats, including blade content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Fat-Free Framework is a lightweight PHP framework designed to provide simple and flexible tools for building web applications. It contains many useful features such as routing, database access, caching, etc. In the Fat-Free framework, using the Blade template engine can help us manage and render templates more conveniently. Blade is the template engine in the Laravel framework, which provides powerful syntax and template inheritance capabilities. In this article I will demonstrate how to use Bl in Fat-Free framework

According to news from this site on January 9, Razer officially launched the new Blade 14 and Blade 16 gaming laptops at CES2024 today, available in black & mercury colors. Blade 14: Equipped with AMD Ryzen 98945HS processor, 8 cores and 16 threads, acceleration frequency 5.2GHz, optional NVIDIARTX4070 graphics card, maximum performance release of 140W, supports independent graphics direct connection, dual memory slots, optional 32GB DDR55600MHz memory, maximum support 96GB; standard 1TB PCle4.0 solid-state drive, supports double-sided M.2, can be expanded to a maximum of 4TB2.5K-240Hz gaming screen (IPS), 16:10 aspect ratio, 100% DCI-P3 color gamut, CAL

In the Laravel framework, using the Blade template engine can help us write view files more conveniently and quickly. The layout file feature allows us to easily reuse view files and improve coding efficiency. This article will introduce how to use Blade's layout file in the Laravel framework and give specific implementation steps. First, we need to understand what a layout file is in the Blade template engine. Simply put, a layout file is a special view file in which the

Laravel is currently one of the most popular PHP frameworks. Its elegant syntax structure and practical functions make it the first choice for developers. Among them, Blade is one of Laravel's own template engines. It is very easy to use and provides rich syntactic sugar. In this article, we will learn how to generate views using Blade. Creating a view in Laravel In Laravel, we can create a view through the run command: phpartisanmake:vie

Overview of methods for rendering views using Blade template engine in Laravel framework: Laravel is a popular PHP framework that provides powerful features and tools to quickly develop web applications. One of the important features is the Blade template engine, which helps developers render views as easily as possible. The Blade template engine is the default template engine provided by Laravel. It combines concise syntax and powerful functions to make view rendering simple and flexible. This article will show you how to

Laravel is an excellent development framework based on PHP. It has the advantages of being easy to learn, efficient, and safe, and is deeply loved by WEB developers. Among them, LaravelBlade template layout is a very practical function in the Laravel framework. This article will show you how to use LaravelBlade template layout through actual cases. What is Blade template layout? The Blade template engine is the default view engine of the Laravel framework. Compared with the template of PHP's native syntax,

As Laravel becomes a popular PHP framework, its development has become more and more convenient. In the Laravel framework ecosystem, there are many excellent extension packages, one of which is LaravelLivewire. This extension package can easily implement real-time interactive experience, and is very suitable for use in Laravel's Blade view. This article will introduce how to use Laravel Livewire to implement Blade components, allowing you to easily build real-time dynamics

CakePHP is a popular PHPMVC framework, and Blade is one of the very popular template engines in the Laravel framework. Although CakePHP comes with a powerful template engine, sometimes we may want to use other template engines to replace the default one. In this article, I will introduce how to use the Blade template engine in CakePHP3, hoping to help some developers who want to try Blade. Install Blade First, we need to install Blade
