Announcement

Collapse
No announcement yet.

How do I add tables via BB Code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I add tables via BB Code?

    I searched and found only one topic on this subject and the answer didn't seem to display correctly on my site so I thought I'd ask here. I'd like to enable my users to use tables, rows and columns in the body of the message editor using BB codes.

    For example: [td] td [/td]
    [tr] tr [/tr]

    I tried to implement this via BB code and I can get a table with rows and columns to display but there is a big chunk of whitespace before the table starts. I figure either this can't be done, or that I've messed up something in my BB code implementation so I'm hoping someone has an example they can share with me that works.

    Thanks in advance!

  • #2
    wouldn't it just be as easy as making a table tag, a tr tag and a td tag.. like this:

    Table tag:
    Code:
    <table +all the table settings you want>{param}</table>
    "Param" in this case is the [tr] tag..

    TR tag:
    Code:
    <tr>{param}</tr>
    "Param" in this case is the [tr] tag..

    TD tag:
    Code:
    <td +all the table settings you want>{param}</td>
    "Param" in this case is the content of the tablecell..

    if you want users to be able to add settings themselves, just add more params.. for example: in the TD tag, you could add:

    Code:
    colspan="{param}"
    ..I think.

    Experiment.. (though I think there allready is a hack for tables over att vbulletin.org/forum)

    Comment


    • #3
      You know that's pretty much exactly what I have, but again, when I test it out I get a bunch of whitespace above the actual table in the message body, as if a user had hit a carriage return several times first. Feel free to check its use on www.caymanclub.net my site to see what I mean.

      Comment


      • #4
        Have you tried to set cellspacing and cellpadding to 0?
        Haven't tried this at all myselft, since I'm to lazy to make 3 new BB codes with my current internet connection.. just manually looked through code modifications at vb.org though, didn't find it and searching for "BB code" is totally useless.. sorry =\

        Comment


        • #5
          Originally posted by K-mans View Post
          I searched and found only one topic on this subject and the answer didn't seem to display correctly on my site so I thought I'd ask here. I'd like to enable my users to use tables, rows and columns in the body of the message editor using BB codes.

          For example: [td] td [/td]
          [tr] tr [/tr]

          I tried to implement this via BB code and I can get a table with rows and columns to display but there is a big chunk of whitespace before the table starts. I figure either this can't be done, or that I've messed up something in my BB code implementation so I'm hoping someone has an example they can share with me that works.

          Thanks in advance!
          This is a well-documented issue. The problem is, every carriage return in a post is rendered as a <br /> tag. Even if those carriage returns are in the midst of table tags. It is the web browser which is not appreciating <br /> tags outside the context of <tr> and <td> and is rendering them ABOVE the table. If you don't want extra spaces to appear, you must not have any carraige returns in your tables which you do not intend to appear.

          Wrong:

          [table]
          [tr]
          [td]column 1[/td]
          [td]column 2[/td]
          [/tr]
          [tr]
          [td]this is the contents of the first row of column 1[/td]
          [td]this is the contents of the first row of column 2[/td]
          [/tr]
          [/table]

          Right:

          [table][tr][td]column 1[/td][td]column 2[/td][/tr][tr][td]this is the contents of the first row of column 1[/td][td]this is the contents of the first row of column 2[/td][/tr][/table]

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X