frm
Well-known member
I have been racking my brain around how we can allow users to input more information into a BBCode tag without an add on to create it, and it seems that the methodology would be to finally give BBCode a refresher after all these years.
For starters, some BB codes don't require a closing tag. An example of this would be sharing media gallery items with:
Instead of having a closing tag, why not treat it with an opening tag only, like some HTML tags and XF syntax?
And
Why not a refresher (with backward compatibility to allow for a closing tag if users are too used to it) to:
But that wouldn't be the only update for a custom BB code refresher.
How about {option} supporting full JSON support, and instead of only HTML replacement, allow for XF syntax and functions too.
It would be difficult for some users to grasp, but it would be up to forum admins to create the custom BB code and then educate users on how to use it.
But the idea would be to have at least 1 {option} such as:
With HTML replacement also allowing for XF template syntax, we could create a "card" of John to display like this:
By obviously creating the table structure in HTML, but for the name, using something like
, age
, and for the cars, since XF syntax could be used,
As it'd also support XF syntax, (custom) macros of add ons could be used with the args of id, allowing for even more flexibility by calling XenForo variables too. This could also essentially allow the creation of custom BB code for add ons that don't come with BB code to call in any place BB code is accepted and use their macros (or create a macro) for output of desired content, which you could combine 2 or 3 add on's macros into 1 custom BB code if you wanted.
If JSON is too difficult, then, why not multiple {option} variables like:
Then instead of {option} we could use any of the variables set such as {name}/{CUSTOM.name}, {age}/{CUSTOM.age}, and {cars}/{CUSTOM.cars} as an array to be used in the above
example of the HTML/XF syntax replacement.
It'd allow for much more advanced BB codes without the need of creating add ons to accomplish certain tasks, especially if we can use functions in the replacement too (e.g. to do math with the given numbers or format dates differently).
The possibilities of a custom BB code to do anything would be almost endless then and we wouldn't have to rely on developers to create an add on to make a custom BB code, if we took the time to learn XF syntax and familiarized ourselves with having more {options} (variables) and how macros of certain add ons work to create our own for use in BB code.
With the options we have available to us now, we can only really output 2 things, {option} and {tag}, but we couldn't do date formatting, etc., unless XF syntax and functions were also a part of the replacement.
In summary
For starters, some BB codes don't require a closing tag. An example of this would be sharing media gallery items with:
Code:
[GALLERY=album, 100][/GALLERY]
Instead of having a closing tag, why not treat it with an opening tag only, like some HTML tags and XF syntax?
HTML:
<img src="" />
HTML:
<xf:avatar user="{$xf.visitor}" size="o" canonical="true" />
Why not a refresher (with backward compatibility to allow for a closing tag if users are too used to it) to:
Code:
[GALLERY=album, 100 /]
But that wouldn't be the only update for a custom BB code refresher.
How about {option} supporting full JSON support, and instead of only HTML replacement, allow for XF syntax and functions too.
It would be difficult for some users to grasp, but it would be up to forum admins to create the custom BB code and then educate users on how to use it.
But the idea would be to have at least 1 {option} such as:
Code:
[CUSTOM id={"name":"John", "age":30, cars":["Ford", "BMW", "Fiat"]} /]
With HTML replacement also allowing for XF template syntax, we could create a "card" of John to display like this:
Name | Age | Cars owned |
---|---|---|
John | 30 | Ford BMW Fiat |
By obviously creating the table structure in HTML, but for the name, using something like
Code:
{{ id.name }}
Code:
{{ id.age }}
HTML:
<xf:foreach loop="{{ id.cars }}" key="$key" value="$cars" i="$i">
{$cars}<br />
</xf:foreach>
As it'd also support XF syntax, (custom) macros of add ons could be used with the args of id, allowing for even more flexibility by calling XenForo variables too. This could also essentially allow the creation of custom BB code for add ons that don't come with BB code to call in any place BB code is accepted and use their macros (or create a macro) for output of desired content, which you could combine 2 or 3 add on's macros into 1 custom BB code if you wanted.
If JSON is too difficult, then, why not multiple {option} variables like:
Code:
[CUSTOM name=John, age=30, cars=Ford|BMW|Fiat]
Then instead of {option} we could use any of the variables set such as {name}/{CUSTOM.name}, {age}/{CUSTOM.age}, and {cars}/{CUSTOM.cars} as an array to be used in the above
Code:
<xf:foreach>
It'd allow for much more advanced BB codes without the need of creating add ons to accomplish certain tasks, especially if we can use functions in the replacement too (e.g. to do math with the given numbers or format dates differently).
The possibilities of a custom BB code to do anything would be almost endless then and we wouldn't have to rely on developers to create an add on to make a custom BB code, if we took the time to learn XF syntax and familiarized ourselves with having more {options} (variables) and how macros of certain add ons work to create our own for use in BB code.
With the options we have available to us now, we can only really output 2 things, {option} and {tag}, but we couldn't do date formatting, etc., unless XF syntax and functions were also a part of the replacement.
In summary
- Don't require a closing tag for BB code that doesn't have or require {text}, with or without an optional trailing slash.
- Allow JSON formatting for {option} or the ability to set multiple variables or allow for multiple variables to be set and called by their name somehow.
- Allow XF syntax and functions to be a part of the HTML replacement
Upvote
1