Custom BB Code basics

Get help developing custom BBCodes or request one.
Post Reply
thom_forum
Registered User
Posts: 3
Joined: Thu Aug 09, 2018 2:06 pm

Custom BB Code basics

Post by thom_forum » Thu Aug 09, 2018 2:15 pm

Good afternoon everyone,

I set up phpBB3.2 recently, to see if it would be usable for our purposes. So far it's looking good, but there's a few things I can't get done right (entirely my fault, I assume).

I'm trying to set up ways for people to post code from another forum (using it's own brand of BB code) by simply copy&paste, and it's supposed to get rendered correctly in the phpBB forum. Most of this is really straightforward and easily done as custom BB Code. But I'm missing some basics, so some of the things I can't work out yet.
Ok, get to the point.

This is a Minimum Working Example of code as it would come from the other forum:

Code: Select all

[table][tr][th colspan=3 align=center]Lineup Undefined[/th][/tr]
[tr][td]1[/td][td]2[/td][td]3[/td][/tr]
[/table]
This would create a table with the head spanned over 3 columns. I can't work out for the life of me how to tell phpBB to convert that propperly.
I'm currently trying

Code: Select all

[th {TEXT1?} {TEXT2?}]{TEXT3}[/th]
converting to

Code: Select all

<td {TEXT1} {TEXT2} style="text-align:left;font-weight:bold;background-color:#c0c0c0;border: 1px solid black;padding: 8px;">{TEXT}</th>


I read about using {TEXT1?} in case some token isn't required, which is the case here - the colspan (or the align=center) could be omitted.

Like I said (and the above ham-fisted coding proves) I'm really fumbling through this blindly and needs some pointers.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51255
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Custom BB Code basics

Post by Brf » Thu Aug 09, 2018 2:31 pm

Moved to Custom BBCode forum...

Have a look at some of the topics further down this forum. Joshyphp is your expert. A "space" is a valid character within a TEXT tag, so separating TEXT tags with a space (or just about any other character) will not work.

thom_forum
Registered User
Posts: 3
Joined: Thu Aug 09, 2018 2:06 pm

Re: Custom BB Code basics

Post by thom_forum » Fri Aug 10, 2018 12:53 pm

Thanks for the move.
Right, the token definition actually mentions that. So, I SHOULD be able to work with just one TEXT-token, right? Here's my latest, failed attempt:

BBCode:

Code: Select all

[th{TEXT1?}]{TEXT2}[/th]
HTML Replacement:

Code: Select all

<td {TEXT1} style="text-align:left;font-weight:bold;background-color:#c0c0c0;border: 1px solid black;padding: 8px;">{TEXT2}</th>
Notice I cleaned up an error in the last token, where I had only used {TEXT} in the replacement initially. Still, no dice.

Is this "add ? to make the token optional" an actual thing? Or was that blog post I came across valid? Is there some deeped documentation on Custom BBCode somewhere? I really looked, but can't find much worthwhile.

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 2 guests