2

I have a string, I want it to covert HTML as I print it to my blade.php file.

String is like

"<a href=\"http://localhost/myProject/shop/Tom-Shop/MjNzaGFkb3c=\">Tom</a>"

I have following code in my blade for output

<div class="commentText w100">
  <p >{{$comment['comment']}}</p>
</div>

but i code get executed same string comes to the paragraph, I want to print anchor tag should get printed,

Note: I have tried php htmlentities() for this purpose and do R&D as much as i can but nothing worked for me .

2
  • 3
    Try {!! $comment['comment'] !!} to output without escaping Commented Jul 18, 2017 at 11:02
  • 1
    @VincentDecaux please post an answer. It deserve to be accepted Commented Jul 18, 2017 at 11:07

3 Answers 3

7

You Need to do like below:-

{!! $comment['comment'] !!}
Sign up to request clarification or add additional context in comments.

Comments

3

You can use following syntax also :

<?php echo $comment['comment']; ?>

Or

In the way of laravel as follow :

{!! $comment['comment'] !!}

Comments

1
{!! html_entity_decode($comment['comment']) !!}

if you are using laravel 5

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.