MyBB Community Forums

Full Version: [MyCode] Table with alternated rows
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is not a simple MyCode because there's a small addition in the global.css file, I'll do a plugin later if it's useful.

The goal: creating tables in MyBB posts with alternate lines design (odd and even).

It requires 4 MyCode and 3 css addition.

--- MyCode ---

Table

Regular Expression :
\[table\](.*?)\[/table\]
Replacement :
<table class="tborder tfixed clear" cellspacing="0" cellpadding="5"  style="border:0; radius:0;">$1</table>

Table row

Regular Expression :
\[tr\](.*?)\[/tr\]
Replacement :
<tr class="trowaltern">$1</tr>

Table head

Regular Expression :
\[th\](.*?)\[/th\]
Replacement :
<th class="thead" valign="middle" style="text-align:center; border-radius:0;"><strong>$1</strong></th>

Table data

Regular Expression :
\[td\](.*?)\[/td\]
Replacement :
<td valign="top">$1</td>

--- CSS ---
/* global values for table data */
.trowaltern > td {
	border: 1px solid;
	border-color: #fff #ddd #ddd #fff;
}
/* even row background */
.trowaltern:nth-child(even) { background: #f5f5f5; }
/* odd row background */
.trowaltern:nth-child(odd) { background: #efefef; }
Cool!
Tnx for sharing Smile
Thank you for MyCode Table

I did the steps but does not show the table

that its my table example:
Quote:<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>

result: Huh
[Image: Table-My-Code-Example.png]

any feedback or support to add table.

thanks in advance.
Are you using mycode tags or html tags?
The correct usage is this:
[table]
[tr]
[th]Firstname[/th]
[th]Lastname[/th]
[th]Age[/th]
[/tr]
[/table]
ohh Sorry.. i am lost that in post  Blush

Yes, Work Perfect!

Thanks in advance chack1172 for Support.  today i am customize the forum and forgot some tiypes mycode.

+1 Thank You for Support Blush

Angel