• 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?

#1
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.
 

EQnoble

Well-known member
#6
Is there anyone you know of who will write a custom importer?
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.
 

Jake Bunce

XenForo moderator
Staff member
#7
XenForo has this function to perform the conversion:

XenForo_Html_Renderer_BbCode::renderFromHtml

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.
 

Attachments