0

I have a text like

<a href="http://www.google.com" target="_blank">www.google.com</a> 

I want to show this text as www.google.com with click able option and this should open in in new tab. I have used strip_tags, but it only displays the content without click able option.

Below is my code:

 {{ strip_tags(nl2br($user->content)) }}

How can I do this in laravel?

Nigel Ren
  • 56,122
  • 11
  • 43
  • 55
user4311278
  • 71
  • 1
  • 7

1 Answers1

1

You just need to output it, strip_tags actualy strips HTML tags off. Just do {{ $user->content }} and you should have the desired output.

Marco
  • 2,757
  • 1
  • 19
  • 24
  • Can you include example with the blade html? Something like my comment in the question – ljubadr Oct 18 '17 at 21:08
  • I already gave you, it's literally just {{ $user->content }} based, of course, on what you said, that the value of $user->content is the HTML of anchor, you are rendering a template, so you just need to output it's value. – Marco Oct 20 '17 at 10:42