Home Backend Development PHP Tutorial Blade template engine-common grammar formats Three Kingdoms blade textblade superblade

Blade template engine-common grammar formats Three Kingdoms blade textblade superblade

Jul 29, 2016 am 08:48 AM
blade

  1. 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' }}

  2. Print the original content of the variable , usage without escaping
    {!! 'My list <script>alert("spam spam spam!")</script>' !!}

  3. Loop
    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

    @if (count($lists) > 1)
  4. @elseif ()
    @else
    @endif

    Use the following syntax in the template to create content Placeholder

    @yield('content')

  5. Use the template in the view using the following syntax

    @extends('layouts.master')

  6. Use the following syntax to populate the placeholder content

    @section('content')
  7. content
    @endsection

    Use the following syntax to reference sub-php files

    @include('partial')
  8. @include('partials.row', ['link' => $link])
    , pass parameters to sub-files
    How to decide whether to use some public content in sub-views

    @section('advertisement')
  9. 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')
    @parent
    child content
    @endsection
    Only if @parent is used here, the content defined in the advertisement in the template will be displayed in the subview10. 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

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25: How To Unlock Everything In MyRise
    4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

How to use template engine Blade in Fat-Free framework? How to use template engine Blade in Fat-Free framework? Jun 03, 2023 pm 08:40 PM

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

Razer Blade 14/16 2024 gaming laptop released: equipped with AMD Ryzen 9 8945HS and Intel Core i9-14900HX processors Razer Blade 14/16 2024 gaming laptop released: equipped with AMD Ryzen 9 8945HS and Intel Core i9-14900HX processors Jan 11, 2024 pm 04:36 PM

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

How to use layout files of template engine Blade in Laravel framework? How to use layout files of template engine Blade in Laravel framework? Jun 03, 2023 pm 04:21 PM

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 development: How to generate views using Laravel Blade? Laravel development: How to generate views using Laravel Blade? Jun 13, 2023 pm 08:36 PM

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

How to use the Blade template engine to render views in the Laravel framework How to use the Blade template engine to render views in the Laravel framework Jul 28, 2023 pm 05:12 PM

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 development: How to use Laravel Blade template layout? Laravel development: How to use Laravel Blade template layout? Jun 14, 2023 am 10:41 AM

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,

Laravel development: How to implement Blade components using Laravel Livewire? Laravel development: How to implement Blade components using Laravel Livewire? Jun 15, 2023 pm 06:30 PM

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

How to use Blade with CakePHP? How to use Blade with CakePHP? Jun 04, 2023 am 10:01 AM

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

See all articles