开发者

CodeIgniter word_wrap and I code

So, I have this problem that when I word_wrap the text field. But wh开发者_StackOverflow中文版en I word_wrapped, it didn't get the </i> so, it ended up with whole website got italic text.

<?php echo word_limiter($news_item['text'], 10); ?>

How do I fix that?

... Now i just realized that every tag HTML (i begin, but not end) I do, does still work? I just use the XSS fixer... Shouldn't it fix this as well? And more importantly how do I fix this, but I still want to allow clean HTML. (But they have to close the tag!!!!)

> <John13> Hello [14:13] <John13> When I use the xss clean (function) It
> doesn't prevent tags that ain't closed. How do I fix it? [14:14]
> <John13> For example <b>blablabla.... (end of post) Now all rest of
> text will be bold on the site.


strip_tags() - "strip_tags — Strip HTML and PHP tags from a string"

So try this

<?php echo word_limiter(strip_tags($news_item['text']), 10); ?>

EDIT: How to close unclosed HTML Tags?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜