Jump to content

Strip_tags not working?


giventoflyfish

Recommended Posts

I might have something wrong here. I'm trying to strip the HTML from a blog article and only show 200 characters. It seems to work but I get strange characters. What did I do wrong?

          {{$trimmedValue = strip_tags($entry->content()|raw, "<p><div><span><br><hr><b><i><em><strong><img>"); }}
          {{$trimmedValue = substr($trimmedValue, 0, 200);  }}
          {$trimmedValue} <a href="{$entry->url()}">Read More</a>

screenhtml.png

Link to comment
Share on other sites

22 hours ago, Hulu said:

Not sure why you have $entry->content()|rawraw is usually used with the templates.

Try taking the |raw out and see if that doesn't fix the problem.

Thanks. Removing the raw did correct the issue. Not fully understanding why it worked. The raw produced all the content in raw format, including the HTML tags.

Link to comment
Share on other sites

  • 6 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...