Using <table> in entries

Found a bug? Tell us!!
Post Reply
David Rowe
Posts: 1
Joined: Tue Feb 22, 2005 3:09 pm

Using <table> in entries

Post by David Rowe »

If I insert

<table border = 1>
<tr>
<td>hi there</td>
</tr>
</table>

into my entry to create a tidy table, the table is displayed several rows down from where it is expected. Is there a reason for this?

Othere common html tags seem to work. Bug?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Using <table> in entries

Post by garvinhicking »

The reason is that by default serendipity has the NL2br (newline to break) plugin installed which converts every newline to a break. You can either remove that markup plugin (and then need to insert breaks manually!) or you remove the linebreaks after your <table> stuff.

Sadly this is because its very hard to make the nl2br plugin detect html tags and it would create other trouble possibly. We've discussed this quite often on the mailinglist, I think we had a solution to use a bbcode tag for entering tables or something like that...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
julianhopkins
Regular
Posts: 17
Joined: Tue Mar 18, 2008 4:07 am
Location: Malaysia
Contact:

Re: Using <table> in entries

Post by julianhopkins »

I have a related problem, hope this is the right place to mention it.

I want to post a snippet of code (for people to copy and paste a hotlinked banner), the bbcode

Code: Select all

 tag works to display it, but it is all in one long line which is not nice (see here: http://julianhopkins.net/index.php?/pages/myblogs2009.html).

If I put it on two lines, the </br> tag is inserted, which means the code is no good for copying and pasting.

Any suggestion? Thanks :)
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Using <table> in entries

Post by onli »

What happens if you disable nl2br for this entry and put the code in two lines? Does the bb-parser react?
If not: I use <pre>-tags for code. This should work, if nl2br is disabled.
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Using <table> in entries

Post by Don Chambers »

<pre> may, or may not, work well depending on your template.

Another option might be <textarea>your code here </textarea>. I did this on several static pages, one of which is here:
http://www.optional-necessity.com/demo/ ... 0x250.html
=Don=
julianhopkins
Regular
Posts: 17
Joined: Tue Mar 18, 2008 4:07 am
Location: Malaysia
Contact:

Re: Using <table> in entries

Post by julianhopkins »

Thanks :)

I had tried <pre> already, but it made no difference at all.

The <textarea> works, but now the box it appears in is too small! :| Is there any way to determine how big it is?

Or maybe does it have something to do with the size of the panel as indicated in the code itself?

*Edit* No worries, I checked with http://www.w3schools.com/ (very useful resource) and found how to adjust the size using 'rows' and 'cols':
e.g. <textarea rows="5" cols="40">
Post Reply