BBCode problem

Get help developing custom BBCodes or request one.
Post Reply
robert1234
Registered User
Posts: 2
Joined: Sun Dec 28, 2008 7:48 pm

BBCode problem

Post by robert1234 » Sat Oct 21, 2017 8:13 pm

Hello there.
I'm a newbie when it comes to HTML and that, but I have been trying to make my own BBCode and I've encountered some problems.

Here's a picture on how it looks:
Image

The problem is that I can't use any other BBCodes inside of it and I can't switch to a new line by pressing enter.
I'd like some assistance to figure out on how to edit the HTML code so I can use BBCodes inside the box and to switch to new lines.

Here's the code for example and the HTML:

Code: Select all

[fieldset={COLOR},{COLOR2}]{TEXT},{TEXT2}[/fieldset]

Code: Select all

<fieldset style="width: auto; border: 1px solid #000000; padding: 10px; background-color: white; ">
<legend style="font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 1.1em; border1 1px solid #000000; padding: 4px; color: {COLOR}; background-color: {COLOR2};"><b> {TEXT}</b></legend>
<div style="margin-left: 1em;">{TEXT2}</div>
</fieldset>
Thank you and sorry if the code is bad. I'm really new to this, haha.

User avatar
JoshyPHP
Code Contributor
Posts: 753
Joined: Mon Jul 11, 2011 12:28 am

Re: BBCode problem

Post by JoshyPHP » Sat Oct 21, 2017 11:46 pm

The short version is this: if you want the BBCodes to apply recursively you can only use one single {TEXT} token for its content. Otherwise, you need multiple BBCodes because everything else is displayed as-is.

You can have as many attributes as you want and I recommend giving them unique names for forward compatibility, e.g. [fieldset foreground={COLOR1} background={COLOR2} legend={TEXT1}]{TEXT}[/fieldset].

You can also combine both forms (named/unnamed attributes) which gives you this:

Code: Select all

[fieldset={COLOR1},{COLOR2},{TEXT1} foreground={COLOR1} background={COLOR2} legend={TEXT1}]{TEXT}[/fieldset]

Code: Select all

<fieldset style="width: auto; border: 1px solid #000000; padding: 10px; background-color: white; ">
	<legend style="font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 1.1em; border1 1px solid #000000; padding: 4px; color: {COLOR1}; background-color: {COLOR2};"><b> {TEXT1}</b></legend>
	<div style="margin-left: 1em;">{TEXT}</div>
</fieldset>
You can use it like this:

Code: Select all

[fieldset=#f00,#fff,Legend]{TEXT}[/fieldset]

[fieldset foreground=#f00 background=#fff legend=Legend]{TEXT}[/fieldset]
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

robert1234
Registered User
Posts: 2
Joined: Sun Dec 28, 2008 7:48 pm

Re: BBCode problem

Post by robert1234 » Sun Oct 22, 2017 4:01 pm

It's working perfectly! Thank you for the help :).

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 8 guests