MyBB Community Forums

Full Version: How to add Table in MyBB forum post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I knew Search button come first but i tried alot

I am not much aware with code edit via cpanel 


can someone please help me with how to add table in my forum post 
[table]
[tr]
	[th][/th]
	[th][/th]
	[th][/th]
[/tr]
[tr]
	[td][/td]
	[td][/td]
	[td][/td]
[/tr]
[tr]
	[td][/td]
	[td][/td]
	[td][/td]
[/tr]
[/table]

if possible
or  page editor that accepts BBCode.
you can try using Table Generator plugin
You can also make it with Mycode if you don't want to use a plugin.

Configuration > Mycode > Add new mycode. You need to make 4

Table
\[table\=(.*?)\](.*?)\[/table\]

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

Table Header
\[th\](.*?)\[/th\]

<th class="tcat" align="middle"><strong>$1</strong></th>

Table Row
\[tr\](.*?)\[/tr\]

<tr>$1</tr>

Table Data
\[td\](.*?)\[/td\]

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



To use:

This gives the table
[table=NAME] [/table]

This gives a row.
[tr] [/tr]

This gives a header column
[th] [/th]

This gives content
[td] [/td]

Change NAME to suit.



Example:

[table=test]
[tr][th]Vegetable[/th][th]Meat[/th][/tr]
[tr][td]Onion[/td][td]Beef[/td][/tr]
[/table]

[Image: PqOTZId.png]

Just add more sections as needed.

Have fun.

Idea taken from other threads on this forum.
thanks a million, worked perfectly, v1.8.20, with 'yourcode' plugin
Hello community!
I have created a new php site with the name: game.
My idea is to insert the embed scripts in table cells. Is that even possible?

I have installed the plugin from .m.`s post was and used the example of sarisisop to create the table (initially only with 2 cells).
On the game site there are FREE embed scripts that you can insert on your site. As far as I understand, this is completely legal. If this is not the case, please inform me ...
Well, I wanted to insert the embed code into the table cells as in the screenshot - with the result that only the code is displayed and not the game.
https://imgur.com/AiP2OAG

Does my idea make sense at all? Is there another possibility?
The game code:

<div>
<script src="https://cdn.htmlgames.com/embed.js?game=ZumaLegend&amp;&amp;bgcolor=white"></script>
</div>

Possibly click the small picture and a new window opens with the game (target_blank)?
https://imgur.com/urRpbOB

THX for your help!
blongso
(2018-05-01, 01:29 PM)sarisisop Wrote: [ -> ]You can also make it with Mycode if you don't want to use a plugin.

Configuration > Mycode > Add new mycode. You need to make 4

Table
\[table\=(.*?)\](.*?)\[/table\]

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

Table Header
\[th\](.*?)\[/th\]

<th class="tcat" align="middle"><strong>$1</strong></th>

Table Row
\[tr\](.*?)\[/tr\]

<tr>$1</tr>

Table Data
\[td\](.*?)\[/td\]

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



To use:

This gives the table
[table=NAME] [/table]

This gives a row.
[tr] [/tr]

This gives a header column
[th] [/th]

This gives content
[td] [/td]

Change NAME to suit.



Example:

[table=test]
[tr][th]Vegetable[/th][th]Meat[/th][/tr]
[tr][td]Onion[/td][td]Beef[/td][/tr]
[/table]

[Image: PqOTZId.png]

Just add more sections as needed.

Have fun.

Idea taken from other threads on this forum.

Here, text alignment is center.
How to keep text align left,center or right?
What changes need to be made for this to work in myBB 1.8.35?

I copied and pasted this, it did not work.

I copied it, modified the table entry to only have one variable for the ID tag.

It just does not work in 1.8.35. Any ideas?
After applying the jscript edit mentioned by Schnapsnase, I can see the table.

Quote:In /jscripts/bbcodes_sceditor.js search for:
// Remove last bits of table, superscript/subscript, youtube and ltr/rtl support
$.sceditor.command
    .remove('table').remove('subscript').remove('superscript').remove('youtube').remove('ltr').remove('rtl');
 
$.sceditor.formats.bbcode
    .remove('table').remove('tr').remove('th').remove('td').remove('sub').remove('sup').remove('youtube').remove('ltr').remove('rtl');
PHP


and replace with:
// Remove last bits of table, superscript/subscript, youtube and ltr/rtl support
$.sceditor.command
    .remove('subscript').remove('superscript').remove('youtube').remove('ltr').remove('rtl');
 
$.sceditor.formats.bbcode
    .remove('sub').remove('sup').remove('youtube').remove('ltr').remove('rtl');
PHP


Now you must create mycodes in ACP for table, table-head, table-row and table-data.
That's all. [Image: wink.gif]


I then updated /inc/languages/english/helpdocs.lang.php by appending the following table row to the example help tables for mycodes:

<tr>
<td class=\"trow1\">A Table<br>
<span style=\"font-weight: bold; color: #ff0000;\">[table=</span>test<span style=\"font-weight: bold; color: #ff0000;\">]</span><br>
<span style=\"font-weight: bold; color: #ff0000;\">[tr][th]</span>Vegetable<span style=\"font-weight: bold; color: #ff0000;\">[/th][th]</span>Meat<span style=\"font-weight: bold; color: #ff0000;\">[/th][/tr]</span><br>
<span style=\"font-weight: bold; color: #ff0000;\">[tr][td]</span>Onion<span style=\"font-weight: bold; color: #ff0000;\">[/td][td]</span>Beef<span style=\"font-weight: bold; color: #ff0000;\">[/td][/tr]</span><br>
<span style=\"font-weight: bold; color: #ff0000;\">[/table]</span></td>
<td class=\"trow1\"><table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" class=\"tborder\" style=\"width:100%\" name=\"tabletest\" id=\"tabletest\">
<tr><th class=\"tcat\" align=\"middle\"><strong>Vegetable</strong></th><th class=\"tcat\" align=\"middle\"><strong>Meat</strong></th></tr>
<tr><td class=\"trow1\" valign=\"top\" align=\"center\">Onion</td><td class=\"trow1\" valign=\"top\" align=\"center\">Beef</td></tr>
</table></td>
<td class=\"trow1\">You would edit the black text items. Also, you need to include a table name, just treat it like an ID tag.</td>
</tr>