Weird custom bbcode behavior

Get help developing custom BBCodes or request one.
Post Reply
ryan77627
Registered User
Posts: 8
Joined: Thu Jul 19, 2018 6:24 pm

Weird custom bbcode behavior

Post by ryan77627 »

Hello! I am trying to create a custom bbcode that will display videos in a post. The code I have acts weird, however. I am using this code just to debug this issue.

Code: Select all

<div>
<video>
<source src="{url}/video.mp4">
<source src="{url}/video.webm">
</video>
</div>
However, when I inspect the video element that is created in a post, only the first source tag shows, then after the first the </video> tag is placed, omitting any following source tags. Does phpbb do some sort of sanitizing to the custom http in bbcode that would cause this? If so, what can I do to change this?

Any help or advice is appreciated, thanks!
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52768
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Weird custom bbcode behavior

Post by stevemaury »

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
ryan77627
Registered User
Posts: 8
Joined: Thu Jul 19, 2018 6:24 pm

Re: Weird custom bbcode behavior

Post by ryan77627 »

I have taken a look at this, I would prefer not to use it however because the video streaming I intend to do requires a custom solution I have put in place already, however it is necessary I have all source tags I insert on the page, instead of one. Thanks for the suggestion, however. I am not sure why the source tags disappear, except for one.
ryan77627
Registered User
Posts: 8
Joined: Thu Jul 19, 2018 6:24 pm

Re: Weird custom bbcode behavior

Post by ryan77627 »

Okay, I played around with the official phpBB 3.2 demo and the same problem exists. However, in the phpBB 3.1 demo, no such problem exists. Could a change in the phpBB parser cause this issue?
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Weird custom bbcode behavior

Post by JoshyPHP »

Tokens are case-sensitive. {url} will not do what you want.

Try using self-closing tags for source.

Code: Select all

<source src="{URL}/video.mp4" />
I wrote the library that handles markup in phpBB 3.2+.
ryan77627
Registered User
Posts: 8
Joined: Thu Jul 19, 2018 6:24 pm

Re: Weird custom bbcode behavior

Post by ryan77627 »

Yeah I know, {url} was a typo in the demo I posted to the board. The real code works. ;)

I tried the self closing tags and it worked! Just for future reference, do all tags for the bbcode have to be closed, or what tags do need to be closed since <source> tags usually aren't closed. Just curious.

Thanks again!
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Weird custom bbcode behavior

Post by JoshyPHP »

The short explanation is that HTML4 elements that don't require an end tag (e.g. img or br) do not have to be closed but elements from other specs (e.g. HTML5) do if they are followed by another element. Additionally, if the template uses any xsl: elements, everything should be closed and the template should be valid XML.

In general I'd recommend closing everything to be on the safe side.
I wrote the library that handles markup in phpBB 3.2+.
Post Reply

Return to “Custom BBCode Development and Requests”