CTA Table BB Code

CTA Table BB Code 1.1.1

No permission to download
You can edit the CSS to suit your requirements.

If you want it for an individual cell, then you would need to create a new bb code and wrap the cell contents in it.
 
This is my third try at finding the right place to post this. I'm trying - yes, I know, very trying. :)

This displays correctly

AbbreviationMeaning
BPBench Press
C&JClean and Jerk


This puts all the white space within table-/table at the top of the post.

AbbreviationMeaning
BPBench Press
C&JClean and Jerk
 
Just a note to fellow xenforites, (unless I'm wrong) [td][/td] cells cannot be empty. The code seems to just skip over those. Therefore, put a "." or "-" in the cell to render it properly ie, [td].[/td]

:D
 
We also figured out that if you leave blank rows between your table data entries - just blank in your editing the post, mind you, not the TD codes with nothing between them, you end up with one blank line at the _top_ of your message for every blank line you left in your table's list of rows.

I would love to see this change since it made it more difficult for me to make a long list of things readable.

-S-
 
This is going to be very useful.
In testing I pasted the test table 'as is' rather than as a continuous string. It worked fine. It's easy to manage for our needs if it's not a string as our table has 300 rows & is regularly edited. Is there a reason we should be posting it as a continuous string?

Thanks
 
Got you. Thanks.

What's the best way to deal with blank cells? Our table is 3 columns & on some rows the middle cell is deliberately blank. With no data in the middle cell the right hand cell moves across.
 
@rwm1962, my fellow administrator Nights provided a fix for that a while back in this thread:

I know how to fix this issue with simple tables.

If you check the 'disable line break conversion' option in the 'table' bbcode, it no longer requires it all to be on a single line. If you open the Custom BB Codes list in the ACP and click on the 'table' bbcode, the rest are of no importance to fix this issue, then click the advanced options tab, you will see the 'disable line break conversion' option. Check that to enable it and then save. This fixed the issue with smaller tables on KHF.

Going over your code I spotted a lot of bad habits. I went through the trouble of re-organizing it but the forum I was testing on went kaput along with roughly 10-20 minutes of work. Seeing as there's a way to fix this with simple tables I'd imagine there's a way to fix it with more in depth tables. I can't exactly test at the moment but try the method above and also try re-organizing your code. I'll keep investigating when I can. Hope that helped.

-Nights
 
Got you. Thanks.

What's the best way to deal with blank cells? Our table is 3 columns & on some rows the middle cell is deliberately blank. With no data in the middle cell the right hand cell moves across.

I just put a "-" character in the blank cells to fix this. It looks just fine (see here for example)
 
Thanks for a great addon.

On my site, it appears that only table rows need to be an unbroken string. For me, this is a signficant benefit, as linebreaks before rows can significantly increase readability. I hope it applies for others.

If it does, would you be willing to mention it in the resource description or simply link to this post?

Edit: another way of putting it is that the code that you mark as "incorrect" seems to work just fine on my forum. No excess <br>s are added and the HTML looks fine.

Demo:
between rows.gif
 
Last edited:
What I don't understand is why linebreak conversion hasn't added linebreak tags within the code. When I view the underlying HTML code that there aren't <br> tags after each row. It seems like the best of both worlds:
upload_2016-2-7_11-52-22.webp

Any thoughts on this? Did I screw something up? I did play with the line break conversion as per the following post, but I turned it back afterward as it prevented me from having table cells with multiple lines of text:
For me it's working when choose the option " Disable line break conversion" on the
BBCode. Now it ignores linebreaks withing the
.
 
Last edited:
Just a note to fellow xenforites, (unless I'm wrong) [td][/td] cells cannot be empty. The code seems to just skip over those. Therefore, put a "." or "-" in the cell to render it properly ie, [td].[/td]

:D
Finally, having read through the entire thread, it seems like @kontrabass's concern, above, seems to come up periodically.

I tried fixing it by changing the following settings for all of the relevant BBCodes:
upload_2016-2-7_12-32-22.webp
However, it didn't work. The table appeared but was too small:
upload_2016-2-7_12-33-7.webp

Given that, however, I'm wondering if it might be a good idea to set all of the BBCodes to "Display HTML replacement when empty." After all, if the post author put in [td][/td], they probably wanted the table data cell there. I don't see a downside and it may make it easier for people to identify malformed code.
 
Hi @arn. Tables by their nature aren't responsive. The workaround is to wrap the table in the [CONTAINER] BB Code. It's described in the overview and a couple of times in the support thread.
 
  • Like
Reactions: arn
Top Bottom