Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
giventoflyfish Posted April 3, 2016 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>
Tom Irons Posted April 4, 2016 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.
giventoflyfish Posted April 5, 2016 Author 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.
DReffects2 Posted October 16, 2016 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.