MyBB Community Forums

Full Version: How Make Table in Post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How Make Table in Post [ Rows & Coloumns ]
hello...

Thank you very much to share these plug in here with us. Normally it is difficult to draw tables in post. But i am really surprised to see that the tables are to be drawn in posts.
Thanks again...
I used the plugin to create custom mycodes. Sharing it for you all:

Table Mycode

Reg EXP:
\[table\=(.*?)\](.*?)\[/table\]

Replacement:
<table border="0" cellspacing="1" cellpadding="3" class="tborder" style="width:$1%;">$2</table>

Table header:

Reg EXP:
\[th\](.*?)\[/th\]

Replacement:
<th class="tcat" valign="middle"><strong>$1</strong></th>


Table row:

Reg EXP:
\[tr\](.*?)\[/tr\]

Replacement:
<tr>$1</tr>



Table data:

Reg EXP:
\[td\](.*?)\[/td\]

Replacement:
<td class="trow1" valign="top" align="center">$1</td>

Hope it's useful.

Demo:
[table=5]
[tr]

[th]TH 1[/th]
[th]TH 2[/th]
[th]TH 3[/th]
[th]TH 4[/th]
[th]TH 5[/th]
[/tr]

[tr]
[td]TD 1[/td]
[td]TD 2[/td]
[td]TD 3[/td]
[td]TD 4[/td]
[td]TD 5[/td]
[/tr]
[tr]
[td]TD 21[/td]
[td]TD 22[/td]
[td]TD 23[/td]
[td]TD 24[/td]
[td]TD 25[/td]
[/tr]
[tr]
[td]TD 31[/td]
[td]TD 32[/td]
[td]TD 33[/td]
[td]TD 34[/td]
[td]TD 35[/td]
[td]TD 36[/td]
[/tr]
[/table]


Demo link : http://arangam.co/mandram/thread-1-post-278.html#pid278

Hope it helps !
Thank you very much.

Working very well.
Hey @itsmegogo are there buttons that can be added to the editor for this?

Hey there's a problem I'm finding when I use the tables.

It spaces everything above the table with several lines of empty spaces/breaks.

Also is there a way to style them without it falling back to the default spacing and coloring?
Thanks