Page 1 of 2

[BBCode] Table

Posted: 20 Apr 2012, 06:38
by Chico Gois
Description: Lets you add custom table.

Features:
- How many lines you want.
- How many columns you want

BBCode:

Code: Select all

[tabela]{TEXT}[/tabela]
HTML replacement:

Code: Select all

<script language="Javascript">
var texto = '{TEXT}';
texto = texto.replace("\r\n","");
texto = texto.replace("<br>","");
texto = texto.replace(" ","");
var linha = new Array();
linha = texto.split('L=');
var table = '<div align="center"><TABLE width=70% cellpadding=1 cellspacing=1 border=0>';
for (var i=1; i<linha.length; i++)
{
  table = table + '<TR>';
  var coluna = new Array();
  coluna = linha[i].split('&');
  for (var j=0; j<coluna.length; j++)
  {
    if (i == 1)
    {
      table = table + '<TD align=center style="background: #FF8904; font-size:11px; color:black; font-family:  Verdana,Arial, Helvetica, sans-serif;"><b>' + coluna[j].replace("amp;","") + '</b></TD>';      
    }
    else
    {
      table = table + '<TD style="background: #878282; font-size:11px; color:white; font-family:  Verdana,Arial, Helvetica, sans-serif;">' + coluna[j].replace("amp;","") + '</TD>';      
    }

  }
  table = table + '<TR>';
}
table = table + '</TABLE></div>';
document.write(table);
</script>
Use:

Code: Select all

Separate the L rows and columns with = &

[tabela]
L=Nome&Nick&Sexo
L=Tiago&Sapporo&Masculino
L=Laura&Witch&Feminino
L=Cesar&Rasec&Masculino
[/tabela]

Obs.:
- The style can be changed completely.
- The first style is referred to the header and the second table with all the other lines.

Screen:
bb.JPG
Demo:
http://www.mundophpbb.com.br/forum/view ... p?f=11&t=8

[BBCode] Table

Posted: 09 May 2012, 05:54
by acidrain83
thx for this table
but i have a little problem
the text is not center.....what can i do???
please help...i have add the bbcode and the html code like here...
only the colors edited

[BBCode] Table

Posted: 09 May 2012, 17:10
by Chico Gois
It has a screen?

[BBCode] Table

Posted: 09 May 2012, 21:34
by Upside555
Thanks , guud bbcode

[BBCode] Table

Posted: 10 May 2012, 06:53
by acidrain83
i know that here is a creen but on my forum it is not center..

[BBCode] Table

Posted: 14 May 2012, 13:54
by webmaster
Nice share dude..!!

[BBCode] Table

Posted: 28 Jun 2012, 17:07
by aydin1954
Hello & nice contribution, simple and efficient.

I was wondering if you could make the style configurable. Have a default if no variables are entered but let the different component of the style be configurable by the user.

Thanks for considering. :thumb:

[BBCode] Table

Posted: 16 Aug 2012, 10:43
by KreatorTeam
Hi, anyone know how to do it this , the link clickable http://i.imgur.com/41EHL.png ?
Thanks !

[BBCode] Table

Posted: 02 Aug 2014, 01:36
by Rigo
I know this thread is old but the code is awesome. I put it on my boards and it shows on the previews I do while working on it. However, when I submit the post, it does not show (it's blank) Why is that?

[BBCode] Table

Posted: 20 Aug 2014, 09:02
by Potku
We have the same problem: preview shows it nicely, but the table disappears once the post has been sent. That's really weird.

This would be so, so much easier than the table BBCode we have had for years. I wish someone could help Rigo and me.