[MyCode] Table with alternated rows
#1
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; }
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM or Discord
Reply
#2
Cool!
Tnx for sharing Smile
MyBB Translator & helper
Please do not PM me requesting free support or help for your forums.
You can see my paid services here.
Reply
#3
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.
Reply
#4
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]
My Projects - Support My Projects

Don't forget to rate posts!
Reply
#5
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)