Sonic Fan Games HQ
Member
- Affected version
- 2.3.3
Apologies if I posted in the wrong forums.
I'm currently working on an update to 2.3. We haven't updated in a while and figured it might be a good time.
With the changes in 2.3 regarding FA icons, I needed to find a way to implement back FA Icons in posts through Custom BBCodes (which is something that should really become native if you ask me, as it's quite useful). I was able to, with help from these two threads:
The BBCode in particular:
However, the icons won't show up while previewing the post:
Editor:
Preview:
As you can see, the space for the icon is there. If I check the inspector, it's also there but with an empty SVG tag:
If I post it, however. It works correctly.
Considering the SVG tag is empty in the preview, I figured it might have something to do with SVGs specifically, but I tried another BBCode with an <svg> tag and it worked flawlessly, so that wasn't it.
Please note, this worked perfectly on our old forums, which was in v2.1.15:
The old BBCode (which no longer works in 2.3):
I'm currently working on an update to 2.3. We haven't updated in a while and figured it might be a good time.
With the changes in 2.3 regarding FA icons, I needed to find a way to implement back FA Icons in posts through Custom BBCodes (which is something that should really become native if you ask me, as it's quite useful). I was able to, with help from these two threads:
The older <i> method does not work. I've tried using the <xf:fa> and that doesn't work either. For example, this produces nothing:
The above is used in a custom BB code:
Code:
<xf:fa icon="fas fa-yin-yang"></xf:fa>
The above is used in a custom BB code:
Code:
<xf:fa icon="fas fa-{text}" />
- schizoidnightmares
- bbcode fontawesome html
- Replies: 17
- Forum: Troubleshooting and problems
Notices don't support XenForo template syntax, ony HTML - the HTML widget does support XenForo template syntax.
(Yes, this is inconsistent ... you may want to check suggestions and / or post a new one)
The reason why you still see a button (but no icons) is due to browsers accepting invalid HTML (
You would get the same visual output with
(Yes, this is inconsistent ... you may want to check suggestions and / or post a new one)
The reason why you still see a button (but no icons) is due to browsers accepting invalid HTML (
<xf:button>...</xf:button>
is invalid HTML) and trying their best to render smth. useful - the tag has a class attribute so the browser applies this to the invalid tag.You would get the same visual output with
Code:
<wtf class="button" icon="save">test</wtf>
<br>
<wtf2 icon="fas...
The BBCode in particular:
Code:
<i class="fas fa-{text}" data-xf-init="icon"></i>
However, the icons won't show up while previewing the post:
Editor:
Preview:
As you can see, the space for the icon is there. If I check the inspector, it's also there but with an empty SVG tag:
If I post it, however. It works correctly.
Considering the SVG tag is empty in the preview, I figured it might have something to do with SVGs specifically, but I tried another BBCode with an <svg> tag and it worked flawlessly, so that wasn't it.
Please note, this worked perfectly on our old forums, which was in v2.1.15:
The old BBCode (which no longer works in 2.3):
Code:
<i class="fas fa-{text}"></i>