Weird custom bbcode behavior

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

Weird custom bbcode behavior

Post by ryan77627 » Thu Jul 19, 2018 6:33 pm

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: 49337
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Weird custom bbcode behavior

Post by stevemaury » Thu Jul 19, 2018 7:56 pm

For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

ryan77627
Registered User
Posts: 4
Joined: Thu Jul 19, 2018 6:24 pm

Re: Weird custom bbcode behavior

Post by ryan77627 » Thu Jul 19, 2018 8:07 pm

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: 4
Joined: Thu Jul 19, 2018 6:24 pm

Re: Weird custom bbcode behavior

Post by ryan77627 » Fri Jul 20, 2018 1:20 am

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: 948
Joined: Mon Jul 11, 2011 12:28 am

Re: Weird custom bbcode behavior

Post by JoshyPHP » Sat Jul 21, 2018 12:41 pm

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 thing that does BBCodes in 3.2.

ryan77627
Registered User
Posts: 4
Joined: Thu Jul 19, 2018 6:24 pm

Re: Weird custom bbcode behavior

Post by ryan77627 » Sun Jul 22, 2018 4:39 am

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: 948
Joined: Mon Jul 11, 2011 12:28 am

Re: Weird custom bbcode behavior

Post by JoshyPHP » Sun Jul 22, 2018 12:02 pm

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 thing that does BBCodes in 3.2.

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 7 guests