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

HTML to BBcode

Discussion in 'General PHP and MySQL Discussions' started by mrb1972, Aug 2, 2011.

  1. mrb1972

    mrb1972 Active Member

    Does any one know of a php script which would take a text string and convert and HTML code to BBcode, I have goggled but could'nt find anything
  2. IuClik

    IuClik Member

  3. mrb1972

    mrb1972 Active Member

    Thay all seem to be online ones, I want one I can add to my own php code
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Again, if this is post content, you can do it with the find-replace add-on.
  5. mrb1972

    mrb1972 Active Member

    No its not post content...- I was hoping for a nice little script to do it all for me..
  6. EQnoble

    EQnoble Well-Known Member

    If you are talking about a script that creates a custom bbcode that can be imported into any software that is probably never going to happen in my lifetime.

    If your talking about a script to convert recognized strings into bbcodes with replacement text you are going to be hard put to find something "out there".

    What exactly are you trying to do? Make a custom bbcode?..if so to do what. If you give a little more information I may be able to help you. Then again I may not...but I can't try if you don't help me help you :)
  7. mrb1972

    mrb1972 Active Member

    I was just converting a few html pages to posts and wanted to convert formatting like <strong> to bbcode, I was just being lazy and trying to find an automatic process... - I ended up making the changes manually
  8. Brogan

    Brogan XenForo Moderator Staff Member

    A simple copy and paste into the editor would have sufficed.

    Source formatting is retained for the most part.
  9. Jeremy P

    Jeremy P Well-Known Member

    Maybe too late now, but XenForo_Html_Renderer_BbCode::renderFromHtml(); is a static PHP method that does what you want. I use it in a custom addon to import news from HTML sources.

Share This Page