giventoflyfish Posted April 3, 2016 Share Posted April 3, 2016 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> Link to comment Share on other sites More sharing options...
Tom Irons Posted April 4, 2016 Share Posted April 4, 2016 Not sure why you have $entry->content()|raw, raw is usually used with the templates. Try taking the |raw out and see if that doesn't fix the problem. Link to comment Share on other sites More sharing options...
giventoflyfish Posted April 5, 2016 Author Share Posted April 5, 2016 22 hours ago, Hulu said: Not sure why you have $entry->content()|raw, raw 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 More sharing options...
DReffects2 Posted October 16, 2016 Share Posted October 16, 2016 Was facing the same problem. The reason why |raw actaully breaks it is because if you execute pure PHP this runs outside the IPS code framework for template output Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.