Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 12:54 pm EST
Geeklog Forums
Faqman and carriage returns
Status: offline
akerin
Forum User
Junior
Registered: 08/22/02
Posts: 19
I'm using the Faqman on our corporate intranet, and I'm running into one problem. If I copy code into the answer text box that has carriage returns in it, e.g.:
<b
> test this
or
Here's
some text
I get this when I show the FAQ answer:
> test this
and
Here's
some text
even though there's no html line break in there. This happens in Mozilla and IE, with htmlarea and without.
Any one else seen this? - Can't show you an example as it's a closed site.
Alex Kerin
<b
> test this
or
Here's
some text
I get this when I show the FAQ answer:
> test this
and
Here's
some text
even though there's no html line break in there. This happens in Mozilla and IE, with htmlarea and without.
Any one else seen this? - Can't show you an example as it's a closed site.
Alex Kerin
11
9
Quote
I recall having a similiar problem many months ago when I was first working on this plugin. I was not sure if I had addressed it before I released the initial version. I just tried a clean install of the faqman and created two test topics where I pasted content from a webpage news article and another using content from MS Word.
In both tests, I did not get any extra line breaks. All line spacing was preserved ok. It's as if normal line breaks are being converted to <br> tags which the PHP function nl2br() will do. The original code had this but I removed it as I recall and my testing above confirmed.
Have you tried various tests from other sources as well?
Geeklog components by PortalParts -- www.portalparts.com
In both tests, I did not get any extra line breaks. All line spacing was preserved ok. It's as if normal line breaks are being converted to <br> tags which the PHP function nl2br() will do. The original code had this but I removed it as I recall and my testing above confirmed.
Have you tried various tests from other sources as well?
Geeklog components by PortalParts -- www.portalparts.com
10
13
Quote
Status: offline
akerin
Forum User
Junior
Registered: 08/22/02
Posts: 19
Looking at the resulting source code it does look like that is happening, though a grep search in my faqman directory, brings up no instances of nl2br in the code. I\'ve tried pasting from word, and just writing the html into the form area.
Both result in the extra br tags. For eaxmple: this in the form:
what
is
happening??
<b
> bolder
Goes to this when viewing the source:
what <br><br>is <br><br>happening??<br><br><b><br>> bolder
Cheers, Alex
Both result in the extra br tags. For eaxmple: this in the form:
what
is
happening??
<b
> bolder
Goes to this when viewing the source:
what <br><br>is <br><br>happening??<br><br><b><br>> bolder
Cheers, Alex
10
11
Quote
Status: offline
akerin
Forum User
Junior
Registered: 08/22/02
Posts: 19
Ok, I have found a fix - looking at the database, the answer text was being inserted into the database with the return and new line characters still in there. The addition of the <br>s was happening later, somewhere else, possibly by htmlarea as a I edited the FAQ again, so this was not the problem.
To fix this, which seems to work so far, I added the following:
$answer = str_replace("r", "", $answer);
$answer = str_replace("n", " ", $answer);
(there is a slash before the r and n that are stripped out by the forum)
at line 136 in topics.php - after this:
$question = str_replace(""", """, $question);
(similarly, there is a slash within the quotes)
This strips out the carriage and new line returns.
Alex
To fix this, which seems to work so far, I added the following:
$answer = str_replace("r", "", $answer);
$answer = str_replace("n", " ", $answer);
(there is a slash before the r and n that are stripped out by the forum)
at line 136 in topics.php - after this:
$question = str_replace(""", """, $question);
(similarly, there is a slash within the quotes)
This strips out the carriage and new line returns.
Alex
10
9
Quote
All times are EST. The time is now 12:54 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content