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

Desarrollo con Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz en Udemy

Acepto recibir anuncios de interes sobre este Blog.

!Cursos a!

10$

En Udemy

Quedan 0 días!

Udemy

!Cursos desde!

4$

En Academia

Ver los cursos

!Libros desde!

1$

Ver los libros
¡Hazte afiliado en Gumroad!
!Web Alojada en Hostinger!