XF 2.2 Article preview text is a jumble. How can we fix this?

Wildcat Media

Well-known member
I have been copying and pasting item reviews from an ancient site over to the XF article format. Thing is, if I have text in the body of the post, it is formatted a certain way. The article itself looks perfect, even with the image pasted in.

Reviewed by: John D'Eau​
Item creator: The Creators
Item title: Thing Created by Us​
Item list: Item 1; Item 2; Item 3, I think; Item 4.​
Contributors: Some One (chief creator), Some Two (another creator), Some Three (someone), Some Four (something.​
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.​

But in the article preview, we get:

Reviewed by: John D'Eau Item creator: The Creators Item title: Thing Created by Us Item list: Item 1; Item 2; Item 3, I think; Item 4. Contributors: Some One (chief creator), Some Two (another creator), Some Three (someone), Some Four (something. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.​

So, it's rather a jumble. I swore there has been a thread or two about this here, but not sure where, and searching for a half hour hasn't turned anything up.

How can we fix this?
 
Thanks @Brogan, that's probably where I saw it before. 👍 (Edit: I already voted on it almost a year ago. They say memory's the second thing to go when we get older... 😁)

In the meantime, I'm wondering if there is something we can modify in the template to change this behavior. I would think it shouldn't be too difficult. I'll have to poke around in the templates when I get a chance and see what I can find.
 
I haven't checked but it's possible the bb code is stripped in code, in which case it won't be possible to alter the behaviour without an add-on.
 
Just doing a quick view of the source shows unformatted text wrapped, but with line breaks, in <div class="bbWrapper">.

Somehow I'm thinking of the nl2br function I used to use when coding PHP. Even if line breaks could be preserved, it would help a lot. The fancy formatting could stay inside the article.

Further down, there is some JSON showing the article excerpt with \n line breaks. So there are newline codes within that body which, of course, HTML can't display.

Got my thinking cap on.

Football Soccer GIF by ElevenSportsBE
 
Interesting what you find with Google search!


{$mytext|nl2br} should work...

I'll have to try this once I'm back to my desk...
 
Top Bottom