I am trying to echo a variable inside an include file.
@include('path.to.some.file')
<?php $var = "Hello World";?>
{!!$var!!}
But when i open the browser i see original code as
{!!$var!!}
instead of the string value assigned to the variable.
However, there is smooth execution of everything on any files without being called through @include.
Here is a screenshot of the issue:
try to use {{ $var }}. I believe your current output is a comment.
OK, after a couple of checkings i just came to see the funny incident that my include file was missing a .blade word in its name, in other words file.blade.php should work fine instead of file.php
Make sure your file ends with .blade.php
, not only .php
.
check your file name, is it file_name.blade.php