Reputation: 75
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
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
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
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
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