No ratings yet.

what is blade in laravel framework










what is blade in laravel framework and how to use blade in laravel framework
blade is a template term used in laravel as in symfony we use twig term .
blade templating engine is very fast and gives a robut view response to public and makes
our development so much fast.Actually blade is a tricky term used in laravel framework
So more you deep into , the more you get to it.
Now we can create template easily with blade.
the synatx for blade view is as follows:
<!– app/views/example.blade.php –>
Now we right code for example.blade.php

<h3>welcome to laravel</h3>
<p>i am giving a new way to laravel for developong my application.</p>

<?php echo $blog-heading; ?>

Now i would go to app’/routes.php
and make following changings:

// app/routes.php

Route::get(‘example’, function()
return View::make(‘example’);

laravel make view keyword handles a lot for developer.laravel knows what is going to happen
to it now. it would take of ‘example’.

And what about the following code:

<?php echo $blog-heading; ?>
they have same affect and implementation on your code snippet.
as laravel understands double curly braces as php output statement with echo.
same we can use
Actually it replaces with php syntax <?php ; ?>
We can use script also with double curly braces and more !
<p>{{ ‘<script>alert(“hello how are you !”);</script>’ }}</p
how we can use control stucture in our laravel
and i am sure you know the basic definition of control sturcture

php code is as follows:

if ($something) : ?>
<p>Something is true!</p>
<? else : ?>
<p>Something is false!</p>
<? endif; ?>


We can replace above with the following one

<!– app/views/example.blade.php –>

@if ($something)
<p>Something is true!</p>
<p>Something is false!</p>

@ is very important contorl sturcture.

for more go to laravel