|
|
Problems with HTML in Stories
- General Posted by King Louie (Tuesday March 06 2001 @ 03:27PM EST) views: 163 |
Hi Folks!
How can i fix the problems in the stories with the HTML on my site! Please see http://kinglouie.nexen.net/stories.php and then the Article Topscorers or NYI-NYR?!
What did I do wrong? (i´m running 5.1 on my site)
|
Related Link
|
By Brian Milby (Tuesday March 06 2001 @ 07:10PM EST)
|
Try to comment out line 126 of parser.inc.php which starts as
$ostring = nl2br($ostring);
|
[ reply | parent ]
|
By Brian Milby (Tuesday March 06 2001 @ 08:19PM EST)
|
After thinking about this for a while, I think I've come up with a good compromise that will suit most users. If the parselevel is 0 or 1, then don't add the breaks. But, if it is 2, 3, or 4 then add the breaks.
if ($parselevel > 1) { $htmlOut = $htmlOut . trim($ostring) . "\n";
} else { $htmlOut = $htmlOut . trim($ostring) . "\n";
}
Note: we don't really need to use the nl2br function since we know that there is only 1 nl in each line and it will be the last character.
|
[ reply | parent ]
|
|
By Brian Milby (Tuesday March 06 2001 @ 08:20PM EST)
|
Well, I think that I just discovered a bug...
There should be a break tag where the bold starts.
|
[ reply | parent ]
|
|
|
By Brian Milby (Tuesday March 06 2001 @ 08:26PM EST)
|
Let's try again...
if ($parselevel > 1) { $htmlOut = $htmlOut . trim($ostring) . "<br>\n";
} else { $htmlOut = $htmlOut . trim($ostring) . "\n";
}
|
[ reply | parent ]
|
|
|
By Glenn (Tuesday March 06 2001 @ 10:39PM EST)
|
Brian, would this fix remedy the odd line breaks caused when text is cut and pasted into the story text box?
Instead of the text 'flowing' what I'm seeing is a ton of BR tags which I'm assuming is the translation of the NL character in the text.
What I'd _like_ to see is that a CRLF be required to generate a BR tag.
Is this what you're doing here?
|
[ reply | parent ]
|
|
|
By Brian Milby (Tuesday March 06 2001 @ 11:30PM EST)
|
Yes, this could solve your problem. You would need to allow full HTML (parselevel 1) and then enter either a blank line (which generates a <p> tag) or a <br> tag to break paragraphs.
|
[ reply | parent ]
|
|
|
By Glenn (Wednesday March 07 2001 @ 12:17PM EST)
|
Worked like a charm..thanks Brian.
|
[ reply | parent ]
|
|
By King Louie (Wednesday March 07 2001 @ 08:42AM EST)
|
I have Full HTML! But I didn`t understand anything! Sorry, but i´ll try it!
|
[ reply | parent ]
|
|
|
|