Laravel Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  |1 | 2 | 3|Last
Lessons:-Blade Templates

Blade Templates
Laravel’s Blade templating engine will allow you to use very neat looking syntax to embed PHP
code within your views. It also includes a number of short-cuts that allow a cleaner use of
existing Laravel features. Blade’s templates are cached by default, which makes them extremely
fast!
As always, let’s jump right in.
13.1 The Basics
To enable Blade templating, simply name your views with the extension .blade.php instead of
.php, it’s as simple as that!
When using view files with PHP frameworks, you will often find yourself using this.
1 <?php echo $val; ?>
By enabling PHP short tags we can tidy this up a little.
1 <?=$val?>
However there is still room for improvement. Let’s have a look at how Blade would handle the
same echo statement.
1 {{ $val }}
Neat! The spacing between the brackets is optional, but I think it looks better with it there. You
see the contents of the double curly brackets is evaluated and echoed out. You can use any PHP
you want in there, for example..
1 {{ 5 * time() }}
This snippet will work just as well. You see all Blade is doing, is converting {{ 5 * time() }} to
<?php echo 5 * time(); ?>. Be sure to consider this if you run into any problems with blade!

 
 
 
image
Anil  Bist

Skills    Laravel

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)