Jump to content

Advanced Bbcode - Tables


Marc

Recommended Posts

Hi guys,
Always do tutorials for people who are less technical than others, so thought it would be about time I did one for the more technical people.

Tables and users.

Earlier I did a rework of the table of members coming to camp so thought I would let people know how I managed to do the tables and the users bbcode. If you are familiar with html you will find this simple ;)

Do, here is an example of what you can do

[table]

[th]Name[/th][th]Status[/th]
[td]BlueWolf[/td][td]Admin[/td]
[td]valkyries[/td][td]Moderator[/td]
[/table]


So do do the above lets start with the table itself. The main table (as in html) is made up of the table itself, the rows, and the data items. So you need to nest the following items

[table]  with the closing [/table]
 
[tr]  with the closing [/tr] tag (this is the row)
 
[td]  with the closing [/td] tag (this is the data itself)
 

 

All rows have to be contained within the table tags for example

 

 

[table]  [tr]   [/tr] [/table]

 

You can have many rows within the table (note I have added linebreaks purely for readability)

[table] 
[tr][/tr]
[tr][/tr]
[tr][/tr]
[tr][/tr]
[/table]

 

Within each of the tr (row) tags you can have your data tags (the cells of the table). They can contain more than one as a table would. Again the spaces between the tags are not required, I have done this simply for readability.

 

[table]
 
[tr] [td]BlueWolf[/td] [td]Admin[/td] [/tr]
[tr] [td]Valkyries[/td] [td]Admin[/td] [/tr]
 
[/table]

 

The above would produce this table

[table]

 

[td]BlueWolf[/td] [td]Admin[/td]

[td]Valkyries[/td] [td]Admin[/td]

 

[/table]

 

So now lets add a header to this table. This uses an additional tag of th instead of the usual tr

 

So for example, note the difference in the top row of our table

 

 

[table]
 
[tr] [th]Name[/th] [th]Status[/th] [/tr]
 
[tr] [td]BlueWolf[/td] [td]Admin[/td] [/tr]
[tr] [td]Valkyries[/td] [td]Admin[/td] [/tr]
 
[/table]

 

This adds the top row as a header and shows like this

 

[table]

[th]Name[/th] [th]Status[/th]

[td]BlueWolf[/td] [td]Admin[/td]

[td]Valkyries[/td] [td]Admin[/td]

[/table]

 

-----------------------------------------------------------------------------------------------------------------------

 

Now that is it for how to do tables, but notice I did something extra in our table in the first place. That being that we have formatted usernames that link to peoples profiles. To do this you can use the member tag in the way as follows

 

[member=marc]
[member="Al Jones"]

 

Note I have added 2 examples above. The quotes are required if the username has a space in the name. These produce the following:

 

Marc

 

 

So I could now do the same within our original table which I would do as follows.

 

 

[table]
[tr][th]Name[/th][th]Status[/th][/tr]
[tr][td][member=BlueWolf][/td][td]Admin[/td][/tr]
[tr][td][member=Valkyries][/td][td]Moderator[/td][/tr]
[/table]

 

Which gives us the desired results :)

[table]

[th]Name[/th][th]Status[/th]
[td]BlueWolf[/td][td]Admin[/td]
[td]valkyries[/td][td]Moderator[/td]
[/table]

 

Link to comment
Share on other sites

Very nice Marc.  Now one question, do table also work in the Signature blocks??  I forget what I was trying to do but that was what prompted me to ask about tables a long time ago ....

 

Cant see any reason why not since its bbcode related

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy , along with dressing your husky as a unicorn on the first Thursday of each month