Mitthun
Mitthun

Reputation: 75

Blade is not working on laravel 4

This is what I have written in my view

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Laravel PHP Framework</title>

</head>
<body>
    <div class="welcome">

        {{Hi everyone}}

    </div>
</body>
</html>

It outputs {{Hi everyone}}

why is it not working ?

Upvotes: 1

Views: 130

Answers (4)

owais
owais

Reputation: 4922

There are diffrent ways to print. However you are just missing quotes. I have listed other methods also... 1. {{'Hi every one'}}
2. <?php $str='hi every one' ?> {{$str}}
3. <?= 'Hi every one' ?>

Upvotes: 0

Dennis Braga
Dennis Braga

Reputation: 1478

First: The view file should be named with a ".blade.php" after it.

Second: The {{ $str }} blade command it's only a shortcut to <?php echo $str ?>. That been said, if you want to just print a string, you should put it between " or even ', as you would probably do with a regular echo statement. Something like echo "Hi everyone";.

That SHOULD work on your case! :D

Upvotes: 2

metude
metude

Reputation: 86

You should call it in your route or controller with return View::make("hello"); etc. Also @Its Aafrin described, your file needs to be renamed as filename.blade.php.

Upvotes: 0

Its Aafrin
Its Aafrin

Reputation: 59

The file needs to be renamed as filename.blade.php. Check if the file had been named as per the convention rules.

Upvotes: 0

Related Questions