Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
BBCode - Comprehensive set of TABLE tags (BB Code) Details »»
BBCode - Comprehensive set of TABLE tags (BB Code)
Version: 1.00, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.0.x Rating:
Released: 09-18-2010 Last Update: 09-18-2010 Installs: 31
Supported
Re-useable Code Translations  

DO NOT USE on vBulletin 4.1.4 or above!
vBulletin 4.1.4 now includes built in support to the TABLE BB Code as part of the new editor. Installing this code will cause conflicts.
If you have this installed, delete it before upgrading to 4.1.4!


WARNING- USING THIS CAN BE A SECURITY RISK!!!
Using this BB Code will allow people who know what they are doing to run arbitrary JavaScript in the code. For this reason I strongly recommend you limit the use of this BB Code to admins and trusted users (mods?) only! You can use the Advanced BB Code Permissions mod to limit this by usergroup. I have it installed on 4.0.8 and it's working well. Thanks to Kyo-Dono for pointing this out.



[tbl],[tr],[td],[th]

Demo URL: http://www.juot.net/forums/showthrea...497#post872497

This is a comprehensive set of codes for making HTML tables. If you're not familiar with HTML tables this code is probably not for you, if you are this should come in very handy.

One of the main limitations of bulletin board software is the inability to put tables into posts. The existing [table] BB Code Mod helps but it is not easy to use and the interface isn't similar to traditional HTML tables. This set of table elements mimic traditional <html> tags and allow for advanced elements like background color, alignment, height and width attributes for any element.
(The existing mod is here: https://vborg.vbsupport.ru/showthread.php?t=107985 you may prefer that to this.)

All HTML tables are made up of at least 3 sets of HTML tags such as:
<table><tr><td>Some Info Here</td></tr></table>

Using this BB Code solution the syntax for the same would simply be:
[tbl][tr][td]Some Info Here[/td][/tr][/tbl]

Note "tbl" is being used instead of "table" to keep compatibility with the existing [table] BB Code.

The code above gives a pretty boring table...

Where this code really shines is that in any of those elements you can use the "option" part of the tag to add attributes to that element, so if you wanted to make the whole table light-blue you could use:
[tbl="bgcolor=lightblue"][tr][td]Some Info Here[/td][/tr][/tbl]

And if you wanted to make the cell 50 pixels high:
[tbl="bgcolor=lightblue"][tr][td="height=50"]Some Info Here[/td][/tr][/tbl]

There are many attributes you may be familiar with for HTML tables, all and any can be used in these tags. A more complicated table would be:
[tbl="border=0 bgcolor=grey align=center"]
[tr][th="bgcolor=lightblue colspan=3"][B]Table Header[/B][/th][/tr]
[tr][td]:pirate:[/td][td="bgcolor=yellow"]:jump:[/td][td]:panic:[/td][/tr]
[tr="bgcolor=pink height=50"][td]:sad:[/td][td]:owned:[/td][td]:thup2:[/td][/tr]
[/tbl]

As you can see you may use other BB Code's within these codes as well as smilies and images.

There are many resources on the web for learning about HTML tables. This is one of many:
http://www.quackit.com/html/codes/html_table_code.cfm

To make this code work its magic we need to install 8 seperate BB Codes (6 if you don't care about table headers).

For each code we want to install it both with and without an "option" attribute- this will make using the code easier when you have no options needed but let you use them anywhere they are needed.

For the sake of simplicity I'm going to skip of few of the most basic steps, BB Codes are generally easy but please make sure you've installed a few before this one.

You can call the tags anything you want, in my examples I used:
tbl = <table> tag... (for compatibility if you have another [table] BB Code installed.
tr = <tr> tag (Table Row)
th = <th> tag (Table Header)
td = <td> tag {Table Data or Cell)

WARNING: If you have the 4.x SUITE there are already table bbcodes for the CMS portion of your site. Because of this you can not use [tr] or [td] as valid bbcode names because they are already in use. Please use something else such as [trr] and [tdd].



For the tags without options use the following replacements:

[tbl]
Code:
<table>{param}</table>
[th]
Code:
<th>{param}</th>
[tr]
Code:
<tr>{param}</tr>
[td]
Code:
<td>{param}</td>
For each of the above I recommend the following example:
[tbl][tr][th]Header[/th][/tr][tr][td]test[/td][/tr][/tbl]
Remember the example won't show correctly until every code in the set is installed.

Add the following code replacements WITH Option-
"Use Option = Enabled"

[tbl]
Code:
<table {option}>{param}</table>
[th]
Code:
<th {option}>{param}</th>
[tr]
Code:
<tr {option}>{param}</tr>
[td]
Code:
<td {option}>{param}</td>
For all the above codes you want to use the following settings:
Disable Word Wrapping inside BB Code = Yes
All Other Disable Options = No

You will now be able to make complete HTML tables using the tags with or without options as needed.
See the Demo above for this code in action.

Please Mark as Installed if you use this.

Download a copy of the .txt file as a backup.

Download Now

File Type: txt table_set_bbcode_v4.txt (3.9 KB, 310 views)

Screenshots

File Type: jpg ss_tblbbcode.jpg (118.3 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-25-2010, 04:57 PM
Tony_FPM Tony_FPM is offline
 
Join Date: Feb 2005
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!

How do i fix this problem with the <br> line breaks ?

Reply With Quote
  #13  
Old 09-25-2010, 05:18 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That seems to be a side effect of putting code on its own/new line... if you remove all the line breaks in your code it works as expected.

In other words use this:
Code:
[tbl][tr][td]123[/td][/tr][tr][td]123[/td][/tr][tr][td]123[/td][/tr][tr][td]123[/td][/tr][/tbl]
Instead of this:
Code:
[tbl]
[tr]
[td]123[/td]
[/tr]
[tr]
[td]123[/td]
[/tr]
[tr]
[td]123[/td]
[/tr]
[tr]
[td]123[/td]
[/tr]
[/tbl]
Reply With Quote
  #14  
Old 09-26-2010, 01:21 AM
sulasno sulasno is offline
 
Join Date: Feb 2010
Posts: 588
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

perhaps installing this would help;

https://vborg.vbsupport.ru/showthread.php?t=230859
Reply With Quote
  #15  
Old 09-26-2010, 03:59 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sulasno View Post
perhaps installing this would help;

https://vborg.vbsupport.ru/showthread.php?t=230859
I'd be interested if anyone tries it but from what I can see I don't think it will be of much help. The issue is vbulletin turns the line-breaks in the editor window into <br> tags outside the table.
Reply With Quote
  #16  
Old 09-26-2010, 04:07 AM
sulasno sulasno is offline
 
Join Date: Feb 2010
Posts: 588
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use the line by line table code together with the mod that I mentioned and there is no extra space

see [link removed]
Reply With Quote
  #17  
Old 09-26-2010, 04:45 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

terrific. thanks!
Reply With Quote
  #18  
Old 10-27-2010, 03:39 AM
bigrover bigrover is offline
 
Join Date: Jun 2010
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In versions 4.0.7 and 4.0.8 I am having problems with the tables created using these new tags or if I enable HTML in posts. In both cases all tables have borders and rules, and no options I include will override this. I used Firebug to look at the elements and found there are entries in the vbulletin.css file that are setting the border. I included the Firebug results in an attachment.

Do these settings not exist in other versions? How can I override this without affecting other parts of the style? I found it is tied to a stylevar restore.
Attached Images
File Type: jpg tableborder.jpg (68.6 KB, 0 views)
Reply With Quote
  #19  
Old 10-27-2010, 12:48 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The solution is in post #9 in this thread.

Alternatively you can hard code the replacement for the [td] tag (with no option) to be:
Code:
<td style="border: 0px;">{param}</td>
Add any additional style attributes you need to over-ride.
Reply With Quote
  #20  
Old 11-27-2010, 06:55 PM
TrigZu TrigZu is offline
 
Join Date: Jul 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Couldn't HTML injection be a potential issue, and is there some other way to fix the spacing issue? The other guys solution didn't work for me, I don't see why it would work... :/
Reply With Quote
  #21  
Old 11-27-2010, 07:22 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TrigZu View Post
Couldn't HTML injection be a potential issue, and is there some other way to fix the spacing issue? The other guys solution didn't work for me, I don't see why it would work... :/
For the HTML injection issue- I don't believe this is a problem. if you put HTML code inside the [tbl][tr[[td] <html here> [/td][/tr][/tbl] code, and HTML is turned off for forums, vBulletin displays the actual code just as if you typed it directly into a post. I tried this with YouTube Embed Code and I saw the actual code, not a video.

If you can think of some other way to exploit this please let me know ASAP I wouldn't want anything that could lead to problems for anyone down the road. I use this code on my forum as well.

As for the spacing issue, if that solution isn't working than you can just take all the linebreaks out of you code... Instead of this:

Code:
[tbl]
[tr]
[td] Test Text [/td]
[/tr]
[/tbl]
Use this:

Code:
[tbl][tr][td] Test Text [/td][/tr][/tbl]
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:54 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04561 seconds
  • Memory Usage 2,348KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (13)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (3)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete