PDA

View Full Version : newlines added between html code


mooreaa
10-10-2008, 09:49 AM
Hello,

I enabled html code on my forum posts, and I added some code to post and noticed that it added line breaks on each line.

Is there a way I can prevent this or remove the line breaks from happenning?

Marco van Herwaarden
10-10-2008, 10:07 AM
Can you post an example?

Lynne
10-10-2008, 03:20 PM
I have html enabled in my Staff forums and I have noticed that everytime I go back to edit it, there are extra page breaks in the code. I don't know that you can do anything about it. I simple keep a copy of it in a text file, edit it there, and when I go to edit it in the Staff thread, I copy/paste it from my text file so it doesn't have all those extra spaces.

mooreaa
10-12-2008, 05:11 AM
Here is an example post that I posted to my forums


if I post a html table

<table>
<tr>
<td>hello</td>
<td>world</td>
</tr>
<tr>
<td>line </td>
<td>2</td>
</tr>
</table>


Then the resulting output code it generates is this:


if I post a html table<br />

<br />
<table><br />
<tr><br />
<td>hello</td><br />
<td>world</td><br />
</tr><br />
<tr><br />
<td>line </td><br />
<td>2</td><br />
</tr><br />
</table><br />
<br />


Look at all the <br> tags on EACH line! I am using my forums to post articles and such some of which have forms so this really messes up the formatting.

The only way to fix this is to put all the code on a single line, but that makes it really hard/messy to edit... I'm not sure if there is a clean or easy way around this issue.

I am thinking I would like to just disable the auto newlines for now... but only on select forums...

Marco van Herwaarden
10-13-2008, 08:22 AM
Does the same happen when you post here on vB.org?

mooreaa
10-13-2008, 08:32 AM
html is not enabled here so I wouldn't know.

veenuisthebest
10-13-2008, 08:41 AM
yes.. this is an old issue with HTML enabled in posts. Whenever you create a HTML table, it leaves lot of empty lines above as <br>'s are inserted.

A workaround with this problem, read Create a table within a post (http://tech6.com/f51/create-table-within-post-t229/). Read the #4th post onwards there.

Thanks

P.S.: @Marco sir, I am not advertising. Its a solution for his problem.

mooreaa
10-13-2008, 09:12 AM
my issue is not only with tables. Your solution to "switch" editor modes doesn't solve the underlying problem that unwanted <br/> are being inserted. I am looking for a way to track down where/why these are being inserted as I am using my forum to post articles and I will not be the only one trying to add html code.

Somewhere in the vbulletin's bb code parsing or postbit creation, these newlines are being added... where these are being added are not quite clear.

Marco van Herwaarden
10-13-2008, 09:16 AM
Enabling HTML to be posted is a huge security risk, and i strongly suggest you do not enable it.

veenuisthebest
10-13-2008, 09:17 AM
well I told you its just a workaround..

This problem IS an an old issue as I stated. Me too looking for a permanent solution for this.

Thanks

mooreaa
10-14-2008, 08:32 PM
So the cause of the line breaks is part of the VB BB code parser. When you disable HTML, it sets the flag:

$donl2br = true;

This in turn causes the do_parse method to replace newlines with <br>'s.

I may be wrong, but it looks like the only way to turn off the br's is to turn HTML support ON.

I found another hacky way around this system that only works on my article system where I directly call the do_parse method... but this is not a general solution.