Display HTML content in Laravel blade

- Andrés Cruz

En español

Display HTML content in Laravel blade

HTML (HyperText Markup Language) is a markup language used to create web pages and of course, this includes web applications. It is a standard that provides a structure based on an XML-based syntax to organize all the content of a web page. HTML using different types of tags; HTML is NOT a programming language since no logic is implemented in HTML but rather a markup language in which what you put is what you get.

Print HTML to blade

Many times we want to display an HTML block directly in a blade view file; which defaults, with:

{{ $html }}

To escape the HTML, we have:

{!! $html !!}

And remember to pass the data from the controller:

class TestController extends Controller
{
    public function index()
    {
        return view("index",['name' => 'Andres Cruz','html' => '<h1>Titulo</h1>']);
    }
}
Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.