April 2015
Beginner
144 pages
3h 13m
English
Now that we have some information in our database, we need to define the templates that are going to display it. Blade is Laravel's lightweight template language and its syntax is very easy to learn. Here are some examples of how Blade can reduce the number of keystrokes and increase the readability of your templates:
|
Standard PHP syntax |
Blade syntax |
|---|---|
|
<?php echo $var; ?>
|
{!! $var !!}
|
|
<?php echo htmlentities($var); ?>
|
{{ $var }}
|
|
<?php if ($cond): ?>…<?php endif; ?>
|
@if ($cond) … @endif
|
If you use the default double braces notation, then variables are escaped. This is to protect against XSS vulnerabilities (explained in more detail in Chapter 7, Authentication and Security). If you really need the raw value of variable ...
Read now
Unlock full access