1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

News Feed Import - Strip HTML?

Discussion in 'XenForo Questions and Support' started by Qwest, Apr 3, 2014.

  1. Qwest

    Qwest Member

    I have a news feed coming in and posting to my forum occasionally and it's working great, except..... the titles include HTML bold tags.

    So I need to be able to strip the <b> tags from the titles. How can I do that? Is there a way to do it in templates? A setting I'm missing?
     
  2. Mike

    Mike XenForo Developer Staff Member

    That would require a code change. We expect HTML in the content potentially, but we have no concept of it in the title (I don't think it's normally expected but it's possibly ambiguous).
     
  3. Qwest

    Qwest Member

    Well I could handle some easy str_replace() coding. I just need to know where to start. Any tips?

    Right now my titles are all messed up and look like this...

    Hey You Look at My <b>Awesome</b> Title!

    With the HTML printed like that.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That requires an addon. Or you can modify this file directly:

    library/XenForo/Model/Feed.php

    The "prepareFeedEntry" function operates on the feed content before it is posted. This requires some coding ability.
     
    Qwest likes this.
  5. Qwest

    Qwest Member

    That's perfect. Precisely the direction I needed thanks!
     
  6. Qwest

    Qwest Member

    Ended up going with strip_tags() in case anyone is interested and reading this at a later date.
     
    ge66 likes this.

Share This Page