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

XF 1.4 Importing HTML Post Content as bbcode?

Discussion in 'Installation, Upgrade, and Import Support' started by SIneDave, Apr 5, 2015.

  1. SIneDave

    SIneDave Member

    Hi All,

    Our big board is full of posts with HTML content, almost all of which are posted by administrators. Our current platform (IPB) allows HTML, so this is just stored raw in the database.

    Slavik has done a tremendous job on a test import for us so we can spot issues, and we have found HTML being stripped to be a huge one. I'm looking for a solution that will allow us to convert to XF and preserve formatting. Ideally, i'd just like the same raw HTML to render in XF, but i'd also be open to a script/regex that replaces HTML with standard bbcodes.

    Does anyone have any ideas/solutions. I can't be the first person to run up against this, but my searches so far have been fruitless.

    Many thanks.
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. SIneDave

    SIneDave Member

    It seems like the script is stripping the HTML outright. Is it possible to prevent that from happening?
  4. Brogan

    Brogan XenForo Moderator Staff Member

    The importer would have to be modified if it is being stripped during the import.
  5. SIneDave

    SIneDave Member

    Is there anyone you know of who will write a custom importer?
  6. EQnoble

    EQnoble Well-Known Member

    You would probably be better converting the html to bbcodes where possible in the source DB before the import if only because a custom importer will cost you more in dollars/time.
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    XenForo has this function to perform the conversion:


    I am attaching a script I made once to apply this, but it's not turnkey and requires some code ability as well as controlled testing for your specific forum.

    Also, if memory serves, this script has a behavior where unrecognized HTML tags are stripped so you need to be very careful. Consult with library/XenForo/Html/Renderer/BbCode.php to see what tags are handled.

    Attached Files:

Share This Page