It is currently January 22nd, 2018, 5:28 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
How to: Create tables in posts with BBCode
Author Message
 Post subject: How to: Create tables in posts with BBCode
PostPosted: April 19th, 2011, 2:48 pm 
Offline
Modelling Gent and Scholar
User avatar

Joined: April 6th, 2011, 9:58 am
Posts: 2666
Location: Down in the tube station at midnight
You may have noticed that there are some oddly named buttons above the message editor labeled "table", "td", "tdo=" and "tr". You can use these to make tables which might be useful if you want to organise a lot of information in a clear way.

To get started with tables, you might find it easier to write your BBCode in a text editor such as Notepad (Windows), TextWrangler/ BBEdit (Mac) or gEdit/ Kate (Linux).

So arm yourself with a text editor and, step by step....

First you need an opening table tag.
Code:
[table]


Now you need to create the first row for your table. To do this, open a tr (table row) tag immediately after your opening table tag, so your code now looks like this:
Code:
[table][tr]


Now you need to create the first cell. In HTML these are called table divisions and have the tag td, which is what I have called our BBCode tag. The first cell will be the overall header which I have called tdo. the opening tdo tag needs to specify a text size attribute. I'm going to use size 5 for this example. So now we have opening tags for a table, the first row, and the cell which contains the headline text. The code so far looks like this:
Code:
[table][tr][tdo=5]


So far so good. Now we are going to enter the headline text and then put the first closing tag in which will come after the headline text. closing tags have / in them.
Code:
[table][tr][tdo=5]This is my table[/tdo]


That's the end of the first row in the new table so we need a closing tag for the tr tag we put in earlier.
Code:
[table][tr][tdo=5]This is my table][/tdo][/tr]


Now if we put a table closing tag at the end of that we will have a table of sorts. A pretty useless one but it shows how tables work as a series of nested tags.
Code:
[table][tr][tdo=5]This is my table][/tdo][/tr][/table]


This is my table


Moving swiftly on, delete that closing table tag and set about making something useful. We need a new row, so we put in another opening tr tag.
Code:
[table][tr][tdo=5]This is my table[/tdo][/tr][tr]


Now we need cells in the new row. Insert an opening td tag, type the text that the cell will contain and close the td tag. This cell will just contain the word "kit".
Code:
[table][tr][tdo=5]This is my table[/tdo][/tr][tr][td]kit[/td]


Now we'll go across the row and fill in some more cells. Again this is just a case of inserting an opening td tag, typing the text you want the cell to contain, and closing the tag. So for three more cells with the words manufacturer, scale, and price in them:
Code:
[table][tr][tdo=5]This is my table[/tdo][/tr][tr][td]kit[/td][td]manufacturer[/td][td]scale[/td][td]price[/td]


Now end the row with a closing tr tag:
Code:
[table][tr][tdo=5]This is my table][/tdo][/tr][tr][td]kit[/td][td]manufacturer[/td][td]scale[/td][td]price[/td][/tr]


We'll insert another row of four cells with their text after the closing tr tag. I'm just going to give the code for the table row and its cells.
Code:
[tr][td]F-86 Sabre[/td][td]Airfix[/td][td]1/72[/td][td]£6.99[/td][/tr]


Looking at the code for a table row and its cells you can see how its made up of a a pair of tr (row) tags with a series of td (cell) tag pairs nested between them. The code so far then looks like this:
Code:
[table][tr][tdo=5]This is my table[/tdo][/tr][tr][td]kit[/td][td]manufacturer[/td][td]scale[/td][td]price[/td][/tr][tr][td]F-86 Sabre[/td][td]Airfix[/td][td]1/72[/td][td]£6.99[/td][/tr]


Now immediately after all that insert another row:
Code:
[tr][td]DH Sea Vixen[/td][td]Airfix[/td][td]1/48[/td][td]£34.99[/td][/tr]


Finally, one more row:
Code:
[tr][td]CH-53E Super Stallion[/td][td]Academy[/td][td]1/48[/td][td]£60[/td][/tr]


And so far we have an very nearly complete table for which the code looks like this:
Code:
[table][tr][tdo=5]This is my table[/tdo][/tr][tr][td]kit[/td][td]manufacturer[/td][td]scale[/td][td]price[/td][/tr][tr][td]F-86 Sabre[/td][td]Airfix[/td][td]1/72[/td][td]£6.99[/td][/tr][tr][td]DH Sea Vixen[/td][td]Airfix[/td][td]1/48[/td][td]£34.99[/td][/tr][tr][td]CH-53E Super Stallion[/td][td]Academy[/td][td]1/48[/td][td]£60[/td][/tr]


The last thing to do is to close that table tag that we put in right at the start. Very often when your code doesn't appear how you expected it to you will find it's because you missed out a closing tag somewhere so always look through to make sure your tags are in pairs. The finished code then looks like this:
Code:
[table][tr][tdo=5]This is my table[/tdo][/tr][tr][td]kit[/td][td]manufacturer[/td][td]scale[/td][td]price[/td][/tr][tr][td]F-86 Sabre[/td][td]Airfix[/td][td]1/72[/td][td]£6.99[/td][/tr][tr][td]DH Sea Vixen[/td][td]Airfix[/td][td]1/48[/td][td]£34.99[/td][/tr][tr][td]CH-53E Super Stallion[/td][td]Academy[/td][td]1/48[/td][td]£60[/td][/tr][/table]


Unfortunately you can't see if you've pulled it off by previewing your post, so you need to submit it and take a look. The edit button is pretty useful sometimes. Use your browser's find function to go through your code looking for tags and see if each opening tag is being closed and vice versa. Stray bits of table code in your message text or scattered to the sides of the table are always down to incomplete tags.

This is my table
kitmanufacturerscaleprice
F-86 SabreAirfix1/72£6.99
DH Sea VixenAirfix1/48£34.99
CH-53E Super StallionAcademy1/48£60


It looks tricky at first glance but really it's just lots of very simple things happening all at once. Practice makes perfect. Hopefully this makes things a little clearer.

_________________
Would ya like to learn to fly? Would ya? Would you like to see me try?


Top
 Profile  WWW  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Macinscott 3 style by HighDefGeek