Custom BBCodes [Deprecated]

Get help developing custom BBCodes or request one.
User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake »

No, it is simple.

Once I post the code, you will see what I mean, but basically you use something like this.

Code: Select all

<table border="1" cellspacing="2" cellpadding="2">
Border is obvious, gives the cells, rows & the table itself a border, the cellspacing & cellpadding just give each cell some space so it don't look cramped.

Luchtzak
Registered User
Posts: 261
Joined: Sat Jul 20, 2002 7:13 pm
Contact:

Re: Custom BBCodes

Post by Luchtzak »

TheSnake wrote:No, it is simple.

Once I post the code, you will see what I mean, but basically you use something like this.

Code: Select all

<table border="1" cellspacing="2" cellpadding="2">
Border is obvious, gives the cells, rows & the table itself a border, the cellspacing & cellpadding just give each cell some space so it don't look cramped.
Looking forward to this bbcode!

User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake »

Sorry about the delay, I got called away.

HTML Tables are simple to do, but making them work with BBCode is a little tricky, try this.

BBCode usage:

Code: Select all

[table]{SIMPLETEXT1}|{SIMPLETEXT2}|{SIMPLETEXT3}|{SIMPLETEXT4}[/table]
HTML replacement:

Code: Select all

<table border="1" cellspacing="3" cellpadding="3"><tr><td>{SIMPLETEXT1}</td><td>{SIMPLETEXT2}</td></tr><tr><td>{SIMPLETEXT3}</td><td>{SIMPLETEXT4}</td></tr></table>
Help line:

Code: Select all

Table: 2 Rows x 2 Cells
Example usage:

Code: Select all

[table]row 1, cell 1|row 1, cell 2|row 2, cell 1|row 2, cell 2[/table]
I've used some colour styling, to make it easier to see which cell & row is which, there is plenty of styling you can do to the table to pretty it up if you want.

Posted output:
Attachments
table-demo.png
table-demo.png (5.44 KiB) Viewed 2354 times

User avatar
Rotten Apple
Registered User
Posts: 211
Joined: Wed Oct 06, 2010 2:27 am
Location: Florida, USA
Name: Vicky
Contact:

Re: Custom BBCodes

Post by Rotten Apple »

Thank you so much for the code! =D It helped a lot. I have a question though, when I use a BBCode to align the table, it creates a huge gap. Is there a way to remove that?

Code:

Code: Select all

[center][table][td3]Member Groups|Males|Females[/td3]
[td3]Black Organization|1|1[/td3]
[td3]CIA Agents|0|0[/td3]
[td3]Civilians|0|0[/td3]
[td3]Criminals|1|0[/td3]
[td3]Private Detectives|1|0[/td3]
[td3]FBI Agents|0|0[/td3]
[td3]Law Enforcement|1|1[/td3]
[td3]Complete Ratio|4|2[/td3][/table][/center]
Custom BBCode:

Code: Select all

[td3]{TEXT1}|{TEXT2}|{TEXT3}[/td3]
HTML Replacement:

Code: Select all

<tr><td>{TEXT1}</td><td>{TEXT2}</td><td>{TEXT3}</td></tr>

Table

Code: Select all

<table border="0" cellspacing="3" cellpadding="3" vAlign="top">{TEXT}</table>
BBCode:

Code: Select all

[table]{TEXT}[/table]
Example:
Attachments
example_census_td3.jpg
example_census_td3.jpg (64.26 KiB) Viewed 2335 times
Last edited by Rotten Apple on Thu Feb 17, 2011 4:14 am, edited 1 time in total.

User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake »

The align your using looks like a center alignment, which is how it should look. Where is the large gap? What exactly are you trying to accomplish with the alignment & how do you ideally want it to look?

User avatar
Rotten Apple
Registered User
Posts: 211
Joined: Wed Oct 06, 2010 2:27 am
Location: Florida, USA
Name: Vicky
Contact:

Re: Custom BBCodes

Post by Rotten Apple »

The large gap appears in both preview and after I post the table. I simply want to align this particular table, therefore enabling members to align the table how they’d like it in the future. The [table] tag is all I’d like to have, but if it’s mandatory for the alignment for this table I can create a new one and disable it from member view.

Center BBCode:

Code: Select all

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

Code: Select all

 <div align="center">{TEXT}</div>
Again, thanks for the help.

User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake »

You still haven't stated what gap is the problem, & what your trying to achieve. I gathered you wanted it centered. Do you mean the gap on the outside of the left & right hand sides of the table content? If so, then that would be a % or px value you need to specify for the width of the table. If the contents of the table is large, then the table will automatically increase in width, otherwise just taking the minimum space required for the contents.

To do that, you need to specify <table width="x%"> x = your value of the width the table takes (px to specify exact value in pixels), then you can either use % or px for the space required for each <td width="x%/px">.

User avatar
Rotten Apple
Registered User
Posts: 211
Joined: Wed Oct 06, 2010 2:27 am
Location: Florida, USA
Name: Vicky
Contact:

Re: Custom BBCodes

Post by Rotten Apple »

Apologies for not being specific.

No, I’m referring to the gap that appears above/before Member Groups | Males | Females in the attachment image in my previous post. This is before the table (and code) starts. This gap only occurs (as aforementioned) after I post or preview the post. When I'm editing it, it's fine - there's no gap.

Also, the table I width is fine.

User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake »

I'm off for some zzz in a min, but if you can run some tests & post back your findings.

Unfortuneatly, I cannot find anything wrong with the code you've posted for tables or aligment. How are normal posting on your board, do they show up at the top of each posting section?

OK, some tests, in your Table you have <table border="0" cellspacing="3" cellpadding="3" vAlign="top">{TEXT}</table> try removing the vAlign="top" then running another test. Also, try running another table test, but this time without the Center alignment bbcode. Try the center bbcode on it's own & see how that displays.

User avatar
Rotten Apple
Registered User
Posts: 211
Joined: Wed Oct 06, 2010 2:27 am
Location: Florida, USA
Name: Vicky
Contact:

Re: Custom BBCodes

Post by Rotten Apple »

I tried what you suggested and it didn’t help. I originally inserted the vAlign="top" thinking that it’d help with the problem, but after removing it (again) and removing the center alignment the gap still appeared. I’m wondering if it might have anything to do with the number of rows and columns there are in the code, maybe? Also,the center alignment code on its own works fine.

Privteer
Registered User
Posts: 18
Joined: Fri Dec 24, 2010 8:56 pm

Re: Custom BBCodes

Post by Privteer »

dbjs2009 wrote:Does anyone knows how to make non google or youtube videos appears in post like the videos of this site:
http://moddb.com/videos/
How can I get the Html replacement?
same ask for me ;)

Luchtzak
Registered User
Posts: 261
Joined: Sat Jul 20, 2002 7:13 pm
Contact:

Re: Custom BBCodes

Post by Luchtzak »

Rotten Apple wrote:Thank you so much for the code! =D It helped a lot. I have a question though, when I use a BBCode to align the table, it creates a huge gap. Is there a way to remove that?

Code:

Code: Select all

[center][table][td3]Member Groups|Males|Females[/td3]
[td3]Black Organization|1|1[/td3]
[td3]CIA Agents|0|0[/td3]
[td3]Civilians|0|0[/td3]
[td3]Criminals|1|0[/td3]
[td3]Private Detectives|1|0[/td3]
[td3]FBI Agents|0|0[/td3]
[td3]Law Enforcement|1|1[/td3]
[td3]Complete Ratio|4|2[/td3][/table][/center]
Is there a way so it can be programmed for x amount of columns ?

User avatar
AmigoJack
Registered User
Posts: 5682
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Custom BBCodes

Post by AmigoJack »

Luchtzak wrote:Is there a way so it can be programmed for x amount of columns ?
Not with custom BBCodes.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake »

Rotten Apple wrote:I tried what you suggested and it didn’t help. I originally inserted the vAlign="top" thinking that it’d help with the problem, but after removing it (again) and removing the center alignment the gap still appeared. I’m wondering if it might have anything to do with the number of rows and columns there are in the code, maybe? Also,the center alignment code on its own works fine.
I've had a look again at your code without finding the cause, so it might be that. I have noticed the way you implemented the code is different to the way I posted it. Have you tried using it in a test on your site, the way I posted?

I cannot guarantee this will resolve it, but give it a try.

BBCode Usage

Code: Select all

[table]{SIMPLETEXT1}|{SIMPLETEXT2}|{SIMPLETEXT3}|{SIMPLETEXT4}|{SIMPLETEXT5}|{SIMPLETEXT6}|{SIMPLETEXT7}|{SIMPLETEXT8}|{SIMPLETEXT9}|{SIMPLETEXT10}|{SIMPLETEXT11}|{SIMPLETEXT12}|{SIMPLETEXT13}|{SIMPLETEXT14}|{SIMPLETEXT15}|{SIMPLETEXT16}|{SIMPLETEXT17}|{SIMPLETEXT18}|{SIMPLETEXT19}|{SIMPLETEXT20}|{SIMPLETEXT21}|{SIMPLETEXT22}|{SIMPLETEXT23}|{SIMPLETEXT24}|{SIMPLETEXT25}|{SIMPLETEXT26}|{SIMPLETEXT27}[/table]
HTML Replacement

Code: Select all

<table border="1" cellspacing="3" cellpadding="3"><tr><td>{SIMPLETEXT1}</td><td>{SIMPLETEXT2}</td><td>{SIMPLETEXT3}</td></tr><tr><td>{SIMPLETEXT4}</td><td>{SIMPLETEXT5}</td><td>{SIMPLETEXT6}</td></tr><tr><td>{SIMPLETEXT7}</td><td>{SIMPLETEXT8}</td><td>{SIMPLETEXT9}</td></tr><tr><td>{SIMPLETEXT10}</td><td>{SIMPLETEXT11}</td><td>{SIMPLETEXT12}</td></tr><tr><td>{SIMPLETEXT13}</td><td>{SIMPLETEXT14}</td><td>{SIMPLETEXT15}</td></tr><tr><td>{SIMPLETEXT16}</td><td>{SIMPLETEXT17}</td><td>{SIMPLETEXT18}</td></tr><tr><td>{SIMPLETEXT19}</td><td>{SIMPLETEXT20}</td><td>{SIMPLETEXT21}</td></tr><tr><td>{SIMPLETEXT22}</td><td>{SIMPLETEXT23}</td><td>{SIMPLETEXT24}</td></tr><tr><td>{SIMPLETEXT25}</td><td>{SIMPLETEXT26}</td><td>{SIMPLETEXT27}</td></tr></table>
Example Usage

Code: Select all

Example Usage: [table-9x3]row 1 cell 1|row 1 cell 2|row 1 cell 3|row 2 cell 1|row 2 cell 2|row 2 cell 3 etc...[/table-9x3]
I had tried implementing the table bbcode in different ways, but this is the only way so far I have found that it works for me. The only problem with the way this is encoded though, you have to have a new table bbcode for each time the amount of table rows/cells are different, but let me know if fixes your problem anyway.
Privteer wrote:
dbjs2009 wrote:Does anyone knows how to make non google or youtube videos appears in post like the videos of this site:
http://moddb.com/videos/
How can I get the Html replacement?
same ask for me ;)
I have already answered that question here with a fully working video bbcode.

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom BBCodes

Post by Pony99CA »

AmigoJack wrote:
Luchtzak wrote:Is there a way so it can be programmed for x amount of columns ?
Not with custom BBCodes.
Sure there is. The example at my Test Board allows any number of columns. The markup is more complicated, though, requiring three BBCodes (TABLE, R and C). Here's the code that I used for the first two examples:

Code: Select all

[table=2,3x2 Table][r][c]R1C1[/c][c]R1C2[/c][/r][r][c]R2C1[/c][c]R2C2[/c][/r][r][c]R3C1[/c][c]R3C2[/c][/r][/table]

[table=3,2x3 Table][r][c]R1C1[/c][c]R1C2[/c][c]R1C3[/c][/r][r][c]R2C1[/c][c]R2C2[/c][c]R2C3[/c][/r][/table]
It's simple to implement, but harder to enter. (You have to careful with column counts and can't have any text between the tags, even newlines.)

In fact, I just created a new C= BBCode that allows column and row spanning. You can see the new examples at the link above.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Locked

Return to “Custom BBCode Development and Requests”